inst/tinytest/strings/test-stri_join_mat.R

expected <- c("abcde", "fghij", "klmno", "pqrst", "uvwxy")

expect_equal(matrix(letters[1:25], ncol=5, byrow = TRUE) |> stri_join_mat(margin=1),
             expected)
expect_equal(matrix(letters[1:25], ncol=5, byrow = FALSE) |> stri_join_mat(margin=2),
             expected)

expect_error(
  matrix(letters[1:25], ncol=5, byrow = TRUE) |> stri_join_mat(margin=3),
  pattern = "`margin` must be either 1 or 2"
)

Try the tinycodet package in your browser

Any scripts or data that you put into this service are public.

tinycodet documentation built on Sept. 12, 2024, 7:03 a.m.