I think this should help: require(pcaMethods) data(metaboliteDataComplete) mdc <- scale(metaboliteDataComplete, center=TRUE, scale=FALSE) ## Now create 5% of outliers. cond <- runif(length(mdc)) < 0.05; mdcOut <- mdc mdcOut[cond] <- 10 ## Now we do a conventional PCA and robustPca on the original and the data ## with outliers. ## We use center=FALSE here because the large artificial outliers would ## affect the means and not allow to objectively compare the results. resSvd <- pca(mdc, method = "svd", nPcs = 10, center = FALSE) resSvdOut <- pca(mdcOut, method = "svd", nPcs = 10, center = FALSE) resRobPca <- pca(mdcOut, method = "robustPca", nPcs = 10, center = FALSE) biplot(resRobPca) # Draw the graph biplot # shows the generic methods("biplot") # which method is used? Depends on the class of the object class(resRobPca) # the class is 'pcaRes' biplot.pcaRes # show the actual code for drawing the object
Kevin On Tue, Apr 24, 2012 at 1:44 PM, Michael <comtech....@gmail.com> wrote: > > biplot > > standardGeneric for "biplot" defined from package "stats" > > function (x, ...) > > standardGeneric("biplot") > > <environment: 0x0d4444d8> > > Methods may be defined for arguments: x > > Use showMethods("biplot") for currently available ones. > > > > > > > > > showMethods("biplot") > > Function: biplot (package stats) > > x="ANY" > > x="character" > > (inherited from: x="ANY") > > x="Pca" > > > biplot(resRobPCA) > > But how do I get the source code of "biplot"? > > Thank you! > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Kevin Wright [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.