library (surveyreader)
library(testthat)
context("Convert 4-level likelihood categories.")
test_that("correct conversion takes place", {
expect_equal( rescale_likely_4 (column =
c("DK",
"Very likely",
"Fairly likely",
"Not very likely",
"Not at all likely"),
underscore = FALSE,
return_class = "character"),
c(NA, "very_likely", "fairly_likely",
"not_very_likely", "not_at_all_likely")
)
expect_equal(rescale_likely_4 (column =
c("DK",
"Very likely",
"Fairly likely",
"Not very likely",
"Not at all likely"),
return_class = "numeric"),
c(NA, 2, 1, -1, -2)
)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.