View source: R/nested_prcomp.R
nested_prcomp | R Documentation |
Powered by prcomp. When creating the nested_data,
the data should be scaled (i.e, trans = scale
) if all variables are not
in the same unit.
nested_prcomp(.data, data_column = .data$data, ...)
.data |
A data frame with a list column of data frames, possibly created using nested_data. |
data_column |
An expression that evalulates to the data object within each row of .data |
... |
Passed to prcomp. |
.data with additional columns 'model', 'loadings', 'variance' and 'scores'
library(dplyr, warn.conflicts = FALSE) nested_pca <- alta_lake_geochem %>% nested_data( qualifiers = c(depth, zone), key = param, value = value, trans = scale ) %>% nested_prcomp() # get variance info nested_pca %>% unnested_data(variance) # get loadings info nested_pca %>% unnested_data(loadings) # scores, requalified nested_pca %>% unnested_data(c(qualifiers, scores))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.