tests/test_rep.coded.R

library(codelist)
source("helpers.R")

x <- code(factor(c("A", "B", NA)))
res <- rep(x, 2)
expect_equal(res, code(factor(c("A", "B", NA, "A", "B", NA))))

x <- code(factor(character(0), levels = c("A", "B")))
res <- rep(x, 2)
expect_equal(res, x)

Try the codelist package in your browser

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

codelist documentation built on April 12, 2025, 2:25 a.m.