statar (version 0.4.0)

group: Group multiple variable (similar to Stata group)

Description

Group multiple variable (similar to Stata group)

Usage

group(..., na.rm = FALSE)

Arguments

...
vectors
na.rm
Should groups where some variable is NA return NA? Default to FALSE

Value

  • An integer vector representing groups

Examples

Run this code
library(dplyr)
mutate(iris, g = group(Species))
mutate(iris, g = group(Species, floor(Sepal.Width)), na.rm = TRUE)

Run the code above in your browser using DataLab