Learn R Programming

tidypaleo (version 0.1.4)

nested_prcomp: Nested Principal Components Analysis (PCA)

Description

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.

Usage

nested_prcomp(.data, data_column = .data$data, ...)

Value

.data with additional columns 'model', 'loadings', 'variance' and 'scores'

Arguments

.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.

Examples

Run this code
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))

Run the code above in your browser using DataLab