Description Usage Arguments Value Examples
Mark the first row in each group of rows.
1 | mark_first_in_each_group(data, group_cols)
|
data |
a data.frame ordered with respect to groups |
group_cols |
character names of the grouping columns |
numeric vector with index of first row in each group
1 2 3 4 5 6 7 8 9 10 11 12 | d <- wrapr::build_frame(
"g", "v" |
1 , 1L |
0 , 2L |
0 , 3L |
1 , 4L |
1 , 5L )
d <- d[wrapr::orderv(d), , drop = FALSE]
d$fi <- mark_first_in_each_group(d, "g")
print(d)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.