tests/testthat/test_select_vars.R

test_that("Correct vars are grabbed", {
    d <- select_vars(iris, c("Sepal.Length", "Species", "Sepal.Width"))
    expect_equal(names(d), c("Sepal.Length", "Species", "Sepal.Width"))
    check_eval(d)
})

library(survey)
data(api)
svy <- svydesign(~ dnum + snum, weights = ~pw, fpc = ~ fpc1 + fpc2, data = apiclus2)

test_that("Surveys supported", {
    d <- select_vars(svy, c("api00", "stype"))
    expect_equal(names(d$variables), c("api00", "stype"))
    check_eval(d)
})

Try the iNZightTools package in your browser

Any scripts or data that you put into this service are public.

iNZightTools documentation built on Oct. 12, 2023, 5:06 p.m.