tests/testthat/test-rescale_low_strong_4.R

library (surveyreader)
library(testthat)
context("Convert 4-level low-strong categories.")

test_that("correct conversion takes place", {
  expect_equal( rescale_low_strong_4 (column =
                                    c("DK",
                                      "Not at all",
                                      "Low",
                                      "Medium",
                                      "Strong"),
                                  underscore = FALSE,
                                  return_class = "character"),
                c(NA, "none", "low",
                  "medium", "strong")
  )
  expect_equal(rescale_low_strong_4 (column =
                                   c("DK",
                                     "Not at all",
                                     "Low",
                                     "Medium",
                                     "Strong"),
                                 return_class = "numeric"),
    c(NA,0,1,2,3)
  )
})
antaldaniel/surveyreader documentation built on May 16, 2019, 2:29 a.m.