tests/testthat/test-remove_labels.R

library(sjlabelled)

test_that("remove_labels", {
  z <- factor(LETTERS[3:1], ordered = TRUE)
  z <- sjlabelled::set_labels(z, labels = c("yes", "maybe", "no"))
  x <- sjlabelled::remove_labels(z, labels = 2)

  expect_equal(attributes(x)$labels, c(yes = "A", no = "C"))
})

Try the sjlabelled package in your browser

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

sjlabelled documentation built on April 10, 2022, 5:05 p.m.