| latexify_report | R Documentation |
report::report() into LaTeX-friendly output.This function transforms the text output from report::report() by performing several substitutions
to prepare the text for LaTeX typesetting. In particular, it replaces instances of R2, %, and ~ with
the corresponding LaTeX code. Additionally, it provides options to:
Omit bullet items marked as "non-significant" (when only_sig = TRUE).
Remove a concluding note about standardized parameters (when remove_std = TRUE).
Wrap bullet items in a LaTeX itemize environment or leave them as plain text (controlled by itemize).
latexify_report(
x,
print_result = TRUE,
only_sig = FALSE,
remove_std = FALSE,
itemize = TRUE
)
x |
Character vector or a single string containing the report text. |
print_result |
Logical. If |
only_sig |
Logical. If |
remove_std |
Logical. If |
itemize |
Logical. If |
A single string with the LaTeX-friendly formatted report text.
if (requireNamespace("report", quietly = TRUE)) {
# Simple linear model on the iris dataset
model <- stats::lm(
Sepal.Length ~ Sepal.Width + Petal.Length,
data = datasets::iris
)
# Format the report output, showing only significant items, removing the
# standard note, and wrapping bullet items in an itemize environment.
report_text <- try(report::report(model), silent = TRUE)
if (!inherits(report_text, "try-error")) {
latexify_report(
report_text,
only_sig = TRUE,
remove_std = TRUE,
itemize = TRUE
)
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.