add_pca: add pca variables to a data frame

Description Usage Arguments Value

Description

add_pca takes a data frame and the columns that you wish to compute the pca values for. You can use dplyr's select rules to pick the columns you want or omit the ones you don't want to include. Only numeric columns are allowed and any rows with missing values will be returned with missing values for the PCA columns. It will append these new pca loadings to the data frame as additional columns.

Usage

1
add_pca(.data, ..., new_column = NULL, n = NULL)

Arguments

.data

A data frame

...

Comma separated list of unquoted expressions. You can treat variable names like they are positions. Use positive values to select variables; use negative values to drop variables.

new_column

the initial name of the new columns to append. If left null then variables will just be returned with .pc and the number for the loading.

n

the number of princple components to return. If left null then all loadings will be returned.

Value

the original data frame with the new principle component columns


mattmills49/helpers documentation built on May 21, 2019, 1:25 p.m.