Skip to content

check_arg("formula") does not flag incorrect formulas for models that are S4 objects #222

@amy-datacamp

Description

@amy-datacamp

In Longitudinal Analysis in R, in exercises with models that are S4 objects, check_arg("formula") does not flag incorrect formulas and the SCT passes with an incorrect entry.

Here is an example from Chapter 4. The following SCT does not highlight mistakes in the formula.

ex() %>% check_correct(
 check_object(., "uncond_ri") %>% check_equal(), 
 check_function(., "glmer") %>% {
   check_arg(., "formula") %>% check_equal(eval = FALSE) 
   check_arg(., "data") %>% check_equal(eval = FALSE)
   check_arg(., "family") %>% check_equal(eval = FALSE)
 } 
)

The following code needs to be included to flag incorrect formula entries:

ex() %>% check_expr("uncond_ri@call$formula") %>% check_result() %>% check_equal(incorrect_msg = "Did you correctly define `uncond_ri`?", append = FALSE)

cc: @sumedh10

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions