cumcount {uniqtag} | R Documentation |
Return an integer vector counting the number of occurrences of each string up to that position in the vector.
cumcount(xs)
xs |
a character vector |
an integer vector of the cumulative string counts
cumcount(abbreviate(state.name, 3, strict = TRUE))