powered by
Group a data frame and add per-group indices as a column.
add_group_indices(.data, groupingVars, indexColumn)
data.frame
character vector of column names to group by.
character name of column to add indices to.
.data with group identifying column added.
# NOT RUN { add_group_indices(datasets::mtcars, c("cyl", "gear"), 'groupID') # }
Run the code above in your browser using DataLab