inst/tinytest/test_syntax_to_add_list.R

suppressMessages(library(lavaan))

out1 <- modelbpp:::syntax_to_add_list(c("m3 ~ m4", "x4 ~ x3", "f0 =~ x1"))
out2 <- modelbpp:::syntax_to_add_list(list("m3 ~ m4", "x4 ~ x3", "f0 =~ x1"))
out3 <- modelbpp:::syntax_to_add_list("m3 ~ m4\nx4 ~ x3\nf0 =~ x1")

out1_check <- list(c("m3", "~", "m4"),
                   c("x4", "~", "x3"),
                   c("f0", "=~", "x1"))

out1_check <- lapply(out1_check,
                      function(x) {
                          names(x) <- c("lhs", "op", "rhs")
                          x
                        })

expect_equal(out1,
              out1_check,
              info = "modelbpp:::syntax_to_add_list")
expect_equal(out2,
              out1_check,
              info = "modelbpp:::syntax_to_add_list")
expect_equal(out3,
              out1_check,
              info = "modelbpp:::syntax_to_add_list")

Try the modelbpp package in your browser

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

modelbpp documentation built on Sept. 30, 2024, 9:40 a.m.