Three-views HTML rendering of a symbolized_model
Source:R/render-three-views.R
as_html_three_views.RdReturns a single self-contained HTML string with three tabs over the same fit:
Equation – matrix-form structural equations.
Index – per-observation equations.
Matrix (with data) – the actual numeric arrays from the fit, with head + tail rows visible and
...in the middle.
Designed to be cat()-ed inside an Rmd / Quarto chunk with
results = 'asis'. The host document supplies math rendering (MathJax /
KaTeX via pandoc); this function emits semantic HTML, inline CSS, and a
small tab-switching script.
Usage
as_html_three_views(
x,
head = 5L,
tail = 2L,
head_cols = 5L,
tail_cols = 2L,
id = "sym",
standalone = FALSE,
file = NULL,
...
)
# S3 method for class 'symbolized_model_set'
as_html_three_views(
x,
head = 5L,
tail = 2L,
head_cols = 5L,
tail_cols = 2L,
id = "sym",
standalone = FALSE,
file = NULL,
...
)Arguments
- x
A
symbolized_modelwith$expandedpopulated.- head
Number of leading rows to show in the matrix view (Tab 3 "Equations with data") before the
\\vdotsellipsis. Default5. Reasonable range 2–10; larger values produce taller widgets.- tail
Number of trailing rows to show in the matrix view after the
\\vdots. Default2. Together withhead, controls how much per-observation data is visible: total rows shown =head + tail + 1ellipsis row (or fewer ifn_obsis small enough to show all rows).- head_cols
Number of leading columns to show in any matrix that has more than
head_cols + tail_colscolumns (e.g. theZ-matrix for a 60-species fit). Default5. Smart-truncation prefers non-zero columns within the visible row band.- tail_cols
Number of trailing columns to show after the
\\cdotsellipsis. Default2.- id
A short identifier so multiple panels can co-exist on one page.
- standalone
If
TRUE, wrap the fragment in a full HTML document with a MathJax CDN bootstrap so the file renders math when opened directly in a browser (file://...). DefaultFALSEreturns the bare fragment for embedding in an Rmd / pkgdown / Quarto page where the host document already loads MathJax.- file
If non-
NULL, also write the HTML to this path. Returned value is unchanged.- ...
Reserved for future use.
Details
For a multi-node structural equation model (a symbolized_model_set,
the shared parent of piecewiseSEM's symbolized_psem and drmSEM's
symbolized_drm_sem), the per-node three-views widget is rendered for
each node and stacked under a <h2>Node: <name></h2> header. Nodes are
read from names(x$parts), so the same method serves either collator.