subset of prcomp object in R
问题 I'm basically computing the PCA for a set of variables and everything works fine. Lets say I'm using the iris data as an example, but my data is different. The iris data should be sufficient to explain my question: data(iris) log.ir <- log(iris[, 1:4]) log.ir[mapply(is.infinite, log.ir)] <- 0 ir.groups<- iris[, 5] ir.pca <- prcomp(log.ir, center = TRUE, scale. = TRUE) library(ggbiplot) g <- ggbiplot(ir.pca, obs.scale = 1,var.scale = 1,groups = ir.groups, var.axes=F) g <- g + scale_color