test_that('fbind binds factors', {
# Success test case 1
a <- iris$species[c(1,51,101)]
b <- PlantGrowth$group[c(1,11,21)]
res <- fbind(a,b)
expect_identical(res, factor(c(levels(iris$species),
levels(PlantGrowth$group))))
# Success test case 2
a <- factor(c("a", "c"))
b <- factor(c("b", "d"))
res <- fbind(a,b)
expect_identical(res,factor(c(levels(a),levels(b))))
# Failure case 1
expect_error(fbind(2,"A"),'One or more inputs are numeric!')
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.