Open MichelNivard opened 4 years ago
Dear Michel, thank you for your message. As GenomicSEM uses lavaan, you should just be able to use tidySEM if you export the lavaan object! Does that work?
I thought about that, but we post-process the lavaan result, so the standard errors (for example) are off, I don't think I want to expose that to the user to avoid confusion. I may use tidySEM as a dependency and run it within GenomicSEM, that could work... Thanks for the feedback.
Dear Michel,
In that case, I would suggest that you use table_results(columns = NULL) inside your function, and update the relevant columns of the resulting object. graph_sem() has a method for the resulting tidy_results
object. If you return a list with a named S3 class and include the tidy_results
as one of the list elements, e.g.:
out <- list(modelfit = modelfit,
results = results,
resid_cov = resid_cov,
tidy_results = tidy_results)
class(out) <- c("genomicsem", class(out))
return(out)
Then you could include tidySEM as a dependency, and export a function from GenomicSEM like this:
#' @method graph_sem genomicsem
#' @export
graph_sem.genomicsem <- function(model,
label = "est_sig",
...){
Args <- as.list(match.call()[-1])
Args$model <- force(model$tidy_results)
do.call(graph_model, Args)
}
Hi,
I want to try and make tidySEM graphing functions work with GenomicSEM (https://github.com/MichelNivard/GenomicSEM ) output. any pointers as to where I can begin? I am cool with building a bridge function in our package that handles wrangling the output in any internal formate tidySEM uses.
Best, Michel