Learn R Programming

Bios2cor (version 1.2)

pca_2d: PCA projection on two dimensions

Description

Given an object of class 'pca' (result of the centered_pca function), draws a graph of the projection of the elements on two dimensions (first and second components by default)

Usage

pca_2d(pca_struct, abs= 1, ord= 2, filepath)

Arguments

pca_struct

An object created by the centered_pca function

abs

An integer which corresponds to the component that will be projected onto the x axis. Default is 1 (first component)

ord

An integer which corresponds to the component that will be projected onto the y axis. Default is 2 (second component)

filepath

The full path name of the png file that will be creared

Value

A 2D graph of the projection of the elements on selected two principal components

Examples

Run this code
# NOT RUN {
  msf <- system.file("msa/toy_align.msf", package = "Bios2cor")
  align <- import.msf(msf)

  #Creating OMES object
  omes <- omes(align)

  #Creating ENTROPY object
  entropy <- entropy(align)

  # Creating PCA structures for OMES method and storing in txt file
  omes <-omes$normalized
  pca <- centered_pca(omes, m= NULL, pc= NULL, dec_val= 5,eigenvalues_csv= NULL)
  pca_2d(pca, abs= 1, ord= 2, "pca_2d.png")
  
# }

Run the code above in your browser using DataLab