add_group_sub {pivotea}R Documentation

Add sub index within group

Description

Add sub index within group

Usage

add_group_sub(df, group, sep = "_", tmp_col = "tmp_col")

Arguments

df

A dataframe.

group

A string or string vector. When vector, the first string will be used for adding sub index.

sep

A string for separator.

tmp_col

A string of colnames for temporary use.

Value

A dataframe.

Examples

library(dplyr)
add_group_sub(mtcars, c("am", "gear"))
add_group_sub(mtcars, c("cyl", "am"))


[Package pivotea version 1.0.1 Index]