Skip to contents

Add id in each group

Usage

add_id(tbl, grp = "group", id = "id")

Arguments

tbl

A dataframe

grp, id

A string to specify the column of group and id

Value

A dataframe

Examples

brk <- "EOS"
tbl <- tibble::tibble(col=c(rep("a", 2), brk, rep("b", 3), brk, rep("c", 4), brk))
add_group(tbl, col = "col") |>
  add_id(id = "id_in_group")
#> Error in dplyr::mutate(tbl, `:=`({    {        grp    }}, cumsum(eval_str(cond)) + 1)):  In argument: `group = cumsum(eval_str(cond)) + 1`.
#> Caused by error:
#> ! object 'tbl' not found