test_df <- data.frame(
col = letters[round(runif(1:100, min = 1,max = 5))]
)
testthat::test_that(
"dummy_vars acts as expected",
{
testthat::expect_equal(
length(unique(test_df[["col"]])),
ncol(dummy_vars(test_df, "col"))
)
testthat::expect_equal(
sort(as.character(unique(test_df[["col"]]))),
colnames(dummy_vars(test_df, "col"))
)
testthat::expect_equal(
nrow(test_df),
nrow(dummy_vars(test_df, "col"))
)
}
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.