View source: R/functions_tools.r
min_cut | R Documentation |
Many continuous variables are very unequally distributed, often with many individuals in the lower categories and fewer in the top. As a result it is often difficult to create groups of equal size, with unique cut-points. By defining the wanted minimum of individuals in each category, but still allowing this minimum to be surpassed, it is easy to create ordinal variables from continuous variables. The last category will not neccessarily have the minimum number of individuals.
min_cut(x, min.size = length(x)/10)
x |
is a continuous numerical variable |
min.size |
is the minimum number of individuals in each category |
a numerical vector with the number of each category
a <- 1:1000
table(min_cut(a))
b <- c(rep(0, 50), 1:500)
table(min_cut(b, min.size = 20))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.