tests/testthat/test_dictionary.R

library(iNZightTools)

cas_raw <- smart_read("cas500_coded.csv")
cas_dict <- read_dictionary("casdict.csv",
    name = "variable",
    title = "friendly_name"
)

cas <- apply_dictionary(cas_raw, cas_dict)

skip_if_not_installed("ggmosaic")
skip_if_not_installed("waffle")

test_that("Variable lables used if present", {
    # devtools::load_all()
    expect_is(inzplot(~height, cas), "inzplotoutput")
    expect_is(inzplot(~height, cas, plottype = "gg_barcode"), "gg")

    expect_is(inzplot(~travel, cas, plottype = "gg_column"), "gg")
})

Try the iNZightPlots package in your browser

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

iNZightPlots documentation built on Oct. 14, 2023, 9:13 a.m.