step_pca | R Documentation |
'StepPca' Does PCA for a set of columns. This currently is an in house function. Use at your own risk!
step_pca(
.rec,
terms,
na_rm = TRUE,
n_comp = 3,
center = TRUE,
scale = TRUE,
role = "predictor",
...
)
.rec |
the R6 recipe object. |
terms |
the unquoted names of the variables to use or a selector function. terms replaces the '...' of the recipes package but requires variables to be included within 'c()'. For example to include variables x and y you would write 'c(x,y)' in the hydrorecipes package. |
na_rm |
logical - should NA values be removed from calculations |
role |
character - the name of the role |
... |
additional arguments |
an updated recipe
set.seed(1)
formula <- as.formula(x~a+b+d+e+f+g)
rows <- 1000
dat <- data.frame(x = rnorm(rows),
a = rnorm(rows),
b = rnorm(rows),
d = rnorm(rows),
e = rnorm(rows),
f = rnorm(rows),
g = rnorm(rows))
rec = recipe(formula = formula, data = dat) |>
step_pca(all_numeric()) |>
plate()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.