library (surveyreader)
library(testthat)
context("Convert attachment 4-level description categories.")
test_that("correct conversion takes place", {
expect_equal( rescale_informed_4 (column =
c("Very well informed",
"Fairly well informed",
"Not very well informed",
"Not at all informed",
"DK", "NT/NV"),
na_labels = "default",
return_class = "character"),
c("very_informed", "informed",
"not_well_informed", "not_informed",
NA, NA)
)
expect_equal( rescale_informed_4 (column =
c("Very well informed",
"Fairly well informed",
"Not very well informed",
"Not at all informed",
"DK", "NT/NV"),
na_labels = "default",
return_class = "numeric"),
c(2, 1, -1, -2, NA, NA)
)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.