tests/testthat/helper-groups.R

expect_groups <- function(df, groups, info = NULL) {
  if (length(groups) == 0L) {
    expect_null(groups(df), info = info)
    expect_identical(group_vars(df), character(), info = info)
  } else {
    expect_identical(groups(df), lapply(enc2native(groups), as.name), info = info)
    expect_identical(group_vars(df), groups, info = info)
  }
}

expect_no_groups <- function(df) {
  expect_groups(df, NULL)
}

Try the dplyr package in your browser

Any scripts or data that you put into this service are public.

dplyr documentation built on July 4, 2019, 5:08 p.m.