check_lavaan_uses: Check that the student specified a specific piece of an edge...

View source: R/check-lavaan.R

check_lavaan_usesR Documentation

Check that the student specified a specific piece of an edge formula

Description

check_lavaan_uses inspects the model data frame produced by check_lavaan_df according to the arguments you specify. If it cannot find any rows in the data frame that match all of the arguments and corresponding values, the function will fail.

Usage

check_lavaan_uses(state, incorrect_msg, append = TRUE, ...)

Arguments

state

state to start from (has to be the state produced by check_lavaan_df)

incorrect_msg

feedback message in case the specified columns and values were not found in the lavaan data frame.

append

whether or not to append the incorrect_msg message to earlier messages that describe the object.

...

named args are columns of lavaanify output, and their values are used to subset that output.

Details

To see which arguments you can pass to the ellipsis argument, use lavaan::lavaanify on a lavaan model. Examples of arguments are lhs, op, and rhs, among others.

Examples

## Not run: 

# example 1
# lavaan::lavaanify(model) produces df with 3 rows
model <- 'a ~ x1'

# sct
ex() %>%
  check_object("model") %>%
  check_lavaan_df() %>%
  check_lavaan_uses(lhs = 'a', op = '~', rhs = 'x1')

# example 2
# lavaan::lavaanify(model) produces df with 6 rows
model <- 'a ~ x1 + x3'

# sct
ex() %>%
  check_object("model") %>%
  check_lavaan_df() %>%
  check_lavaan_uses(lhs = 'a', op = '~', rhs = 'x1')

# sct
ex() %>%
  check_object("model") %>%
  check_lavaan_df() %>%
  check_lavaan_uses(lhs = 'a', op = '~', rhs = 'x3')


## End(Not run)


datacamp/testwhat.ext documentation built on Aug. 26, 2022, 4:12 p.m.