1

I'm trying to plot the robust principal components with prcomp.robust but don't work; however, if I just use the prcomp function it works.

The error message is below:

robust2 <- prcomp.robust(iris[, 1:4], robust="MCD")
autoplot(robust2, data = iris, colour = 'Species')

Error in [.data.frame(plot.data, , c(x.column, y.column)): undefined columns selected Traceback:1. autoplot(robust2, data = iris, colour = "Species", shape = FALSE, . label.size = 6, loadings = TRUE, loadings.label = TRUE, loadings.label.size = 5, . loadings.colour = "black", loadings.label.colour = "red")2. autoplot.prcomp(robust2, data = iris, colour = "Species", shape = FALSE, . label.size = 6, loadings = TRUE, loadings.label = TRUE, loadings.label.size = 5, . loadings.colour = "black", loadings.label.colour = "red")3. t(t(plot.data[, c(x.column, y.column)])/lam)4. t(plot.data[, c(x.column, y.column)])5. plot.data[, c(x.column, y.column)]6. [.data.frame(plot.data, , c(x.column, y.column))7. stop("undefined columns selected")

Andres
  • 43
  • 5
  • Assuming `mdqc` on bioconductor is the package containing `prcomp.robust` and `ggfortify` is the package containing `autoplot` I can replicate the error message. The function `prcomp.robust` returns an object of class `prcomp`. This works fine with the base R `plot` and `biplot` functions. The problem seems to be with `ggfortify` but `prcomp.robust` does not return a list that includes all of the elements that `prcomp` does (no `center` or `scale` parts). You need to contact the maintainers of these packages: `maintainer("ggfortify")`; `maintainer("mdqc")`. – dcarlson Jul 04 '21 at 20:22

0 Answers0