| get_pca_summary | R Documentation |
get pca summary from a prepped recipe that includes step_pca
get_pca_summary(prepped_pca_rec)
prepped_pca_rec |
the prepped pca recipe |
a summary class object containing the standard deviation, proportion of variance, and cumulative proportion of all principal components.
## Not run:
sparrows <- rio::import("https://raw.githubusercontent.com/StirlingCodingClub/Manuscripts_in_Rmarkdown/master/data/Bumpus_data.csv") %>%
mutate(surv = factor(surv),
sex = factor(sex)) %>%
mutate(id = row_number()) %>%
mutate(id = paste0(sex, "_", surv, "_", id)) %>%
mutate(sex = if_else(sex == "male", 1, 0)) %>%
mutate(surv = if_else(surv == "alive", 1, 0))
pca_rec <- recipe(~., data = sparrows) %>%
update_role(id, surv, sex, new_role = "id") %>%
step_normalize(all_predictors()) %>%
step_pca(all_predictors())
pca_prep <- prep(pca_rec)
get_pca_summary(pca_prep)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.