div_quantile {tableeasy} | R Documentation |
Split a continuous variable by quantile statistics. Converts a continuous variable to a categorical variable.
div_quantile(var, div, data)
var |
A string. A variable to be summarized given as a string. |
div |
A positive integer greater than 1 or a vector of integers. If a positive integer greater than 1, it is the number of factor levels when the variable is split by quantile statistics. If a vector of integers, it is the strategy of grouping x by quantile statistics and then merging groups. |
data |
A data frame in which these variables exist. |
A factor variable.
## Load Mayo Clinic Primary Biliary Cirrhosis Data
library(survival)
library(tableeasy)
data(pbc)
## Check variables
head(pbc)
##
div_quantile(var = 'age', div = 5, data = pbc)
div_quantile(var = 'age', div = c(2,3), data = pbc)