Skip to content

A multiple-group issue #44

@winniewytse

Description

@winniewytse

Hello Dr. Cheung and Dr. Lai,

This is a really cool and helpful package for customizing plots of path models in a convenient way with huge flexibility.

I was testing out this package with an output from a multigroup confirmatory factor analysis model which contains two path models of two groups of gender. The semPlot object contains two lists and the functions of semptools do not seem to handle semPlot objects with more than one list.

For example, after fitting a configural model into the data

configural_fit <- cfa(model = model_helpful, 
                      data = helpful, 
                      estimator = "WLSMV", 
                      ordered = c(paste0("H", 1:7)),
                      group = "gender",
                      meanstructure = TRUE, 
                      parameterization = "theta")
summary(configural_fit)

and plotting the path models via semPaths, which yields two plots,

conf_pa <- semPaths(configural_fit, whatLabels = "est", 
                    nCharNodes = 0, nCharEdges = 0)

passing through the object "conf_pa"

conf_pa_ast <- mark_sig(conf_pa, configural_fit)
plot(conf_pa_ast)

will yield an error message as shown below.

rlang::last_error()
<error/rlang_error_data_pronoun_not_found>
Column from_names not found in .data
Backtrace:

  1. semptools::mark_sig(conf_pa, configural_fit)
  1. rlang:::abort_data_pronoun(x)

rlang::last_trace()
<error/rlang_error_data_pronoun_not_found>
Column from_names not found in .data
Backtrace:

  1. ├─semptools::mark_sig(conf_pa, configural_fit)
  2. │ ├─dplyr::select(...)
  3. │ └─dplyr:::select.data.frame(...)
  4. │ └─tidyselect::vars_select(tbl_vars(.data), !!!enquos(...))
  5. │ └─tidyselect:::eval_select_impl(...)
  6. │ ├─tidyselect:::with_subscript_errors(...)
  7. │ │ ├─base::tryCatch(...)
  8. │ │ │ └─base:::tryCatchList(expr, classes, parentenv, handlers)
  9. │ │ │ └─base:::tryCatchOne(expr, names, parentenv, handlers[[1L]])
  10. │ │ │ └─base:::doTryCatch(return(expr), name, parentenv, handler)
  11. │ │ └─tidyselect:::instrument_base_errors(expr)
  12. │ │ └─base::withCallingHandlers(...)
  13. │ └─tidyselect:::vars_select_eval(...)
  14. │ └─tidyselect:::walk_data_tree(expr, data_mask, context_mask)
  15. │ └─tidyselect:::eval_c(expr, data_mask, context_mask)
  16. │ └─tidyselect:::reduce_sels(node, data_mask, context_mask, init = init)
  17. │ └─tidyselect:::walk_data_tree(new, data_mask, context_mask)
  18. │ └─base::eval(expr, data_mask)
  19. │ └─base::eval(expr, data_mask)
  20. │ ├─from_names
  21. │ └─rlang:::$.rlang_data_pronoun(.data, from_names)
  22. │ └─rlang:::data_pronoun_get(x, nm)
  23. └─rlang:::abort_data_pronoun(x)

If the lists inside of "conf_pa" are read one by one (e.g., by specifying conf_pa[[1]]), functions in this package work well.

conf_pa_ast <- mark_sig(conf_pa[[1]], configural_fit)
plot(conf_pa_ast)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions