library (surveyreader)
library(testthat)
context("Wrapper for 3-level good-bad Eurobarometer questions.")
test_that("correct conversion takes place", {
expect_equal(rescale_good_bad_3 (column = c(
"A good thing",
"Neither good nor bad",
"A bad thing", "NA", "DK")),
c(1,0,-1,NA,NA)
)
expect_equal(rescale_good_bad_3 (column =
c("A good thing",
"Neither good nor bad",
"A bad thing", "NA", "DK"),
na_labels = "default",
return_class = "character"),
c("good", "none", "bad",NA, NA)
)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.