| check_lavaan_pattern | R Documentation |
grepl on lavaan model strings.If the pattern is not found, the function throws an error message (that you have to specify explicitly).
check_lavaan_pattern( state, patt, not_string_msg = NULL, incorrect_msg, append = TRUE )
state |
state to start from (should be state produced by
|
patt |
pattern to look for in the lavaan model string that was targeted
with |
not_string_msg |
if specified, this overrides the automatically generated message in case the targetted object is not a string. |
incorrect_msg |
feedback message if calling the function specified in func for if the test fails |
append |
whether or not to append the feedback messages to earlier messages that describe the object. |
## Not run:
# solution model
mod <- 'a =~ x1 + x2'
# student model
# scts that pass
ex() %>%
check_object("model") %>%
check_lavaan_pattern("a")
ex() %>%
check_object("model") %>%
check_lavaan_pattern("a\\s+=~\\s+x1")
# scts that fail
ex() %>%
check_object("model") %>%
check_lavaan_pattern("x2")
ex() %>%
check_object("model") %>%
check_lavaan_pattern("x1\\s\\+\\s+x2")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.