tests/testthat/test-removeNA.R

context("removeNA")

## Support for vectors (using `stats::na.omit`).
## This will return structure attributes about original size, with class omit.
with_parameters_test_that(
    "removeNA", {
        expect_identical(
            object = removeNA(object),
            expected = expected
        )
    },
    object = list(
        character = c("hello", "world", NA),
        numeric = c(1L, 2L, NA),
        DataFrame = DataFrame(
            a = c("A", NA, "C"),
            b = c(NA, NA, NA),
            c = c("B", NA, "D"),
            row.names = c("x", "y", "z")
        )
    ),
    expected = list(
        character = structure(
            .Data = c("hello", "world"),
            na.action = structure(3L, class = "omit")
        ),
        numeric = structure(
            .Data = c(1L, 2L),
            na.action = structure(3L, class = "omit")
        ),
        DataFrame = DataFrame(
            a = c("A", "C"),
            c = c("B", "D"),
            row.names = c("x", "z")
        )
    )
)
steinbaugh/brio documentation built on Jan. 31, 2020, 11:59 p.m.