LoadOntoPCs {pathwayPCA} | R Documentation |
Given a list of loading vectors from a training data set, calculate the PCs of the test data set.
LoadOntoPCs(design_df, loadings_ls, sampleID = c("firstCol", "rowNames"))
design_df |
A test data frame with rows as samples and named features as columns |
loadings_ls |
A list of p \times d loading vectors or matrices as
returned by either the |
sampleID |
Are the sample IDs in the first column of |
This function takes in a list of loadings and a training-centered test data set, applies over the list of loadings, subsets the columns of the test data by the row names of the loading vectors, right-multiplies the test-data subset matrix by the loading vector / matrix, and returns a data frame of the test-data PCs for each loading vector.
A data frame with the PCs from each pathway concatenated by column.
If you have the tidyverse
loaded, this object will display as a
tibble
.
### Load the Data ### data("colonSurv_df") data("colon_pathwayCollection") ### Create -Omics Container ### colon_Omics <- CreateOmics( assayData_df = colonSurv_df[, -(2:3)], pathwayCollection_ls = colon_pathwayCollection, response = colonSurv_df[, 1:3], respType = "survival" ) ### Extract AESPCs ### colonSurv_aespc <- AESPCA_pVals( object = colon_Omics, numReps = 0, parallel = TRUE, numCores = 2, adjustpValues = TRUE, adjustment = c("Hoch", "SidakSD") ) ### Project Data onto Pathway First PCs ### LoadOntoPCs( design_df = colonSurv_df, loadings_ls = colonSurv_aespc$loadings_ls )