Nothing
test_that("remove_na_range removes unused missing ranges", {
x <- labelled_spss_survey(
x = c(1, 2, 3),
na_range = c(97, 99),
id = "s1"
)
result <- remove_na_range(x)
expect_null(labelled::na_range(result))
})
test_that("remove_na_range preserves observed missing values", {
x <- labelled_spss_survey(
x = c(1, 2, 98),
na_range = c(97, 99),
id = "s1"
)
result <- remove_na_range(x)
expect_equal(
labelled::na_range(result),
c(97, 99)
)
})
test_that("remove_na_range preserves interior missing values", {
x <- labelled_spss_survey(
x = c(1, 98, 100),
na_range = c(97, 99),
id = "s1"
)
result <- remove_na_range(x)
expect_equal(
labelled::na_range(result),
c(97, 99)
)
})
test_that("remove_na_range handles unobserved interior ranges", {
x <- labelled_spss_survey(
x = c(1, 100),
na_range = c(97, 99),
id = "s1"
)
result <- remove_na_range(x)
expect_null(labelled::na_range(result))
})
test_that("remove_na_range handles ordinary missing observations", {
x <- labelled_spss_survey(
x = c(1, 2, NA_real_),
na_range = c(97, 99),
id = "s1"
)
result <- remove_na_range(x)
expect_null(labelled::na_range(result))
})
test_that("remove_na_range preserves vectors without missing ranges", {
x <- labelled_spss_survey(
x = c(1, 2, 3),
id = "s1"
)
expect_identical(remove_na_range(x), x)
})
test_that("remove_na_range preserves underlying observations", {
x <- labelled_spss_survey(
x = c(1, 2, 3),
na_range = c(97, 99),
id = "s1"
)
result <- remove_na_range(x)
expect_identical(
vctrs::vec_data(result),
vctrs::vec_data(x)
)
})
test_that("remove_na_range rejects unlabelled input", {
expect_error(remove_na_range(c(1, 2, 3)))
})
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.