# generate test data
df_test <-
dplyr::tibble(
x = c("a","b", "c", NA),
y = c("A","B", NA, NA)
)
df_test <- dplyr::mutate(df_test, new_var = paste_sans_NA(x,y))
test_that("paste_sans_NA handles sinlge NAs", {
expect_equal(df_test$new_var, c("a A", "b B", "c", NA))
})
test_that("paste_sans_NA returns NA when all values are NA", {
expect_true(is.na(df_test$new_var[4]))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.