I'm trying to plot PCA scores using ggbiplot but I can't due to a mismatch between my scores and my groupings. I think the mismatch stems from the NA values in my original log-transformed data (which I omit when I calculate the PCs). Is there a way to get around this so that I can plot using ggbiplot?
GCelem_trans.pca<-prcomp(na.omit(GCelem_trans.log), center=TRUE, scale=TRUE)
GCelem.rxtp <- GCelem[, 9]
g <- ggbiplot(GCelem_trans.pca, obs.scale = 1, var.scale = 1,
groups = GCelem.rxtp, ellipse = TRUE,
circle = TRUE)
Error in `$<-.data.frame`(`*tmp*`, "groups", value = c(2L, 5L, 5L, 2L, :
replacement has 33337 rows, data has 30804
Should I recalculate GCelem.rxtp based on a copy of GCelem that omits any rows with NAs?