scuttle: scuttle

View source: R/scuttle.R

scuttleR Documentation

scuttle

Description

Converts a continuous variable to categorical variable.

Usage

scuttle(
  column,
  split = "quantile",
  labels = c("Low", "Mid", "High"),
  greedy_extremes = TRUE,
  as.factor = TRUE,
  na.rm = TRUE
)

Arguments

column

a continuous numeric vector.

split

the method of splitting the continuous variable. Options include: (1) "quantile" to split the data at the 25th and 75th percentile, (2) "sd"/"sd1" to split the data at one standard deviation below and above the mean, (3) "sd2" to split the data at two standard deviations below and above the mean, (4) "sd3" to split the data at three standard deviations below and above the mean, (5) "se"/"se1" to split the data at one standard error below and above the mean, (6) "se2" to split the data at two standard errors below and above the mean, and (7) "se3" to split the data at three standard errors below and above the mean.

labels

a character vector setting the names for the levels of the new categorical variable. Three levels must be provided.

greedy_extremes

if 'greedy_extremes == TRUE', values at the break points are assigned to the "Low" and "High" groups instead of the "Mid" group. If 'greedy_extremes == FALSE', values at the break points are assigned to the "Mid" group instead of the "Low" and "High" group.

as.factor

specifies whether the categorical variable should be coerced to a factor.

na.rm

a logical value indicating whether 'NA' values should be removed prior to computation.


camkay/panoply documentation built on Jan. 17, 2025, 6:31 a.m.