Nothing
test_that("Errors", {
expect_error(insert.col(1),
"'dat' is neither a 'data.frame', 'matrix', 'tibble' or 'data.table' object.")
})
###
test_that("Insert one column in data.frame by name", {
out <- insert.col(mtcars, toinsert = "mpg", after = "carb")
expect_equal(out, mtcars[, c(2:11, 1)])
out <- insert.col(mtcars, toinsert = "mpg", after = "cyl")
expect_equal(out, mtcars[, c(2, 1, 3:11)])
})
###
test_that("Insert one column in data.table by name", {
mtcars_table <- as.data.table(mtcars)
suppressMessages(out <- insert.col(mtcars_table, toinsert = "mpg", after = "carb"))
mtcars2 <- mtcars
rownames(mtcars2) <- NULL
expect_equal(out, mtcars2[, c(2:11, 1)])
})
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.