Skip to contents

Add group id column into result of morphological analysis

Usage

add_group(
  tbl,
  col,
  brk = "EOS",
  grp = "group",
  cond = NULL,
  end_with_brk = TRUE
)

Arguments

tbl

A dataframe

col

A string to specify the column including breaks

brk

A string to specify breaks

grp

A string to specify group

cond

A string to specify condition

end_with_brk

A logical

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")
#> 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
add_group(tbl, col = "col", end_with_brk = FALSE)
#> 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