Description Usage Arguments Examples
Create an auto-indexing column in a data frame grouped by an id column, with the index starting at 1 for each id column group.
1 | setindex_bygroup(mydf, mycolnum)
|
mydf |
a data frame |
mycolnum |
Number of the id column for your data frame |
1 2 3 4 | id <- c(1,1,2,2,2,3,4,4,5,5)
cat <- c("A", "B", "A", "B", "C", "B", "C", "D", "A", "E")
mydataframe <- data.frame(id, cat)
mydataframe$step <- setindex_bygroup(mydataframe, 1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.