context("Test rep_*")
x <- matrix(1:4, nrow = 2)
test_that("Repeat rows correctly repeats the rows of a matrix", {
expect_equal(
rep_rows(x, 2),
structure(
c(1L, 1L, 2L, 2L, 3L, 3L, 4L, 4L),
.Dim = c(4L, 2L)
)
)
})
test_that("Repeat columns correctly repeats the columns of a matrix", {
expect_equal(
rep_cols(x, 2),
structure(
c(1L, 2L, 1L, 2L, 3L, 4L, 3L, 4L),
.Dim = c(2L, 4L)
)
)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.