Description Usage Arguments Details Value Examples
This function evaluate a string that represents a call to a given PCA function. The function (string) is mounted in a way that data set can be processed by PCA function.
1  | getPCAObject(x, pcaMethod = "prcomp", pcaParams = NULL)
 | 
x | 
 Data set as a data frame. Each column is a variable and each row is a sample.  | 
pcaMethod | 
 The name of PCA function.  | 
pcaParams | 
 The list of parameters to be passed to PCA function.  | 
The parameter pcaParams has a particularity. For example, if name1 need to be an integer (for example, 500), just do c(name1=500). If name1 need to be a name of function, do c(name1='func'). And, if name1 need to be a string, do c(name1='"str"')). This is necessary because of the manner that evaluation is done by R.
This function returns a PCA object obteined from the evaluation of the string command.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22  |   # Example of simple use of getPCAObject
  x = matrix(rnorm(100), 20,5, 
             dimnames=list(NULL, paste('X', 1:5, sep='')))
  pc = getPCAObject(x, pcaMethod="prcomp", 
                    pcaParams=c(scale=TRUE))
  
  
  # Example of using pca function from pcaMethods, 
  #doing calculations with "ppca" and 4 PCs.
  #library(pcaMethods)
  
  x = matrix(rnorm(100), 20,5, 
             dimnames=list(NULL, paste('X', 1:5, sep='')))
  
  library(pcaMethods)
  pc = getPCAObject(x, pcaMethod='pca', 
                    pcaParams=c(method='"ppca"', nPcs=4))
  getLoadingsFromPCA(pc)
  
  getScoresFromPCA(pc)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.