tests/testthat/test-split-labels.r

context("Split labels")

test_that("Empty levels preserved", {
  df <- data.frame(
    fac1 = letters[1:4],
    fac2 = LETTERS[1:4],
    stringsAsFactors = TRUE
  )

  a <- split_labels(df, FALSE)
  b <- split_labels(df[1, ], FALSE)

  expect_that(a, equals(b))

})

Try the plyr package in your browser

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

plyr documentation built on Oct. 2, 2023, 9:07 a.m.