Browse code

removing hard coded parts for percent of variance explained, when returning the compact data frame

Federico Marini authored on 21/03/2022 22:24:01
Showing 1 changed files

... ...
@@ -48,7 +48,7 @@ pcaplot <- function (x, intgroup = "condition", ntop = 500, returnData = FALSE,t
48 48
   colnames(d)[2] <- paste0("PC", pcY)
49 49
 
50 50
   if (returnData) {
51
-    attr(d, "percentVar") <- percentVar[1:2]
51
+    attr(d, "percentVar") <- percentVar[c(pcX, pcY)]
52 52
     return(d)
53 53
   }
54 54