library (surveyreader)
library(testthat)
context("Convert trust description categories.")
rescale_benefit_2 (column =c("DK",
"Would benefit",
"Would not benefit"),
underscore = FALSE,
return_class = "character")
rescale_benefit_2 (column =c("DK","Would benefit",
"Would not benefit"),
return_class = "numeric")
test_that("correct conversion takes place", {
expect_equal(rescale_trust (column = c("DK",
"Tend to trust",
"Tend not to trust",
"tend to trust"),
return_class = "character"),
c(NA, "trust", "distrust", "trust")
)
expect_equal(rescale_trust (column =
c("DK",
"Tend to trust",
"Tend not to trust",
"tend to trust"),
return_class = "numeric"),
c(NA, 1, 0, 1)
)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.