library (surveyreader)
library(testthat)
context("Wrapper for Eurobarometer four-level yes-no questions.")
test_that("correct conversion takes place", {
expect_equal(rescale_yes_no_4 (c("Yes, definitely", "Yes, to some extent",
"No, not really", "No, definitely not", "Missing"),
na_labels = "Missing"),
c(2,1,-1,-2,NA)
)
expect_equal(rescale_yes_no_4 (c("Yes, definitely", "Yes, to some extent",
"No, not really", "No, definitely not", "Missing"),
underscore = FALSE,
return_class = "character",
na_labels = "Missing"),
c("definitely","maybe","maybe not","definitely not",NA)
)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.