| registerSemPlotImporter | R Documentation |
registerSemPlotImporter lets other packages (or users) plug a converter
for their model class into semPlotModel without modifying
semPlot: when semPlotModel (and hence semPaths) receives
an object whose class matches a registered importer, that importer is called
instead of the built-in dispatch.
validateSemPlotModel checks the invariants that semPaths
relies on and stops with a message listing all violations; it is called
automatically by semPaths and is exported so importer authors can test
their converters.
registerSemPlotImporter(class, fun)
validateSemPlotModel(object)
class |
A single class name (character). |
fun |
A function |
object |
A |
The returned model must contain a Pars data frame with the columns
label, lhs, edge, rhs, est, std,
group, fixed and par, and a Vars data frame with
name, manifest and exogenous. Recognized edge types are
"->" (factor loading), "~>" (regression), "<->"
((co)variance), "--" (undirected network edge), "int"
(intercept; lhs must be "") and "|" (threshold).
Registered importers take precedence over the built-in dispatch.
registerSemPlotImporter returns NULL invisibly;
validateSemPlotModel returns the object invisibly or stops.
Sacha Epskamp <mail@sachaepskamp.com>
## Not run:
# In a package providing models of class "myModel":
registerSemPlotImporter("myModel", function(object, ...){
# ... build and return a semPlotModel object ...
})
# Afterwards this works directly:
# semPaths(myModelObject)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.