prep_clusters: Prep Clusters

Description Usage Arguments Examples

View source: R/prep_clusters.R

Description

Prepare a dataframe for clustering. Specify a vector of predictors, scale some or all of them, and specify a response variable. Return a list with the original dataframe (df_for_clustering), the predictors (preds), and the outcome variables (outcome).

Usage

1
prep_clusters(df, preds, to_scale, resp)

Arguments

df

A dataframe containing data to cluster on.

preds

A vector of predictor variables.

to_scale

A subset of those predictors that should be scaled.

resp

The response variable.

Examples

1
2
3
4
5
6
7
8
cluster_on <- c("mpg", "cyl", "disp", "hp", "drat")
to_scale <- c("mpg", "cyl", "disp")
response_vars <- c("gear", "carb")

prep_car_clusters <- prep_clusters(df = mtcars,
                              preds = cluster_on,
                              to_scale = to_scale,
                              resp = response_vars)

aedobbyn/dobtools documentation built on May 28, 2019, 2:33 a.m.