View source: R/factor_segmentation.R
factor_segmentation | R Documentation |
Runs factor analysis with varimax rotation using the psych package.
factor_segmentation( df, vars, weight_var = NULL, num_sols, rotate = "varimax", fac_assign = "avg_loading" )
df |
data.frame of numeric variables. |
vars |
variables to be used in the factor analysis. |
weight_var |
if not NULL, a vector that contains weights for each observation. The NULL case is equivalent to all cases being weighted 1. |
num_sols |
number of segment solutions to run. |
rotate |
method of rotation for factor analysis. See psych::principal() for more details. |
fac_assign |
method to use to assign segments to rows. Options are one of c("avg_loading","max_score"). |
df <- rsegmenter::test_seg_unlabelled segment_input_vars <- c("seg1","seg2","seg3","seg4","seg5","seg6","seg7","seg8","seg9","seg10") factor_segmentation(df = df, vars = segment_input_vars, weight_var = "weight", num_sols=c(2:3), rotate="varimax", fac_assign="avg_loading")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.