min_cut: Cut a continuous variable into categories with a specified...

View source: R/functions_tools.r

min_cutR Documentation

Cut a continuous variable into categories with a specified minimum

Description

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.

Usage

min_cut(x, min.size = length(x)/10)

Arguments

x

is a continuous numerical variable

min.size

is the minimum number of individuals in each category

Value

a numerical vector with the number of each category

Examples

a <- 1:1000
table(min_cut(a))
b <- c(rep(0, 50), 1:500)
table(min_cut(b, min.size = 20))


Rsoc/soc.ca documentation built on March 7, 2024, 8:59 p.m.