mathml.Translate R expressions to MathMLVersion 1.6: with Prolog interface
mathml allows rendering R terms as pretty mathematicalequations, bridging the gap between computational needs, presentation ofresults, and their reproducibility.
Researchers or teachers can already use RMarkdown to conduct analysesand show results,mathml smoothes this process and allowsfor integrated calculations and output. The packagemathmlcan help in fact to improve data analyses and statistical reports froman aesthetical perspective, as well as regarding reproducibility ofresearch, by allowing also for a better detection of possible mistakesin R programs.
The package supports both MathML and Latex/MathJax for use inRMarkdown documents, presentations and Shiny Apps.
This R package is distributed under a BSD-2 simplified license (seethe file LICENSE).
Download and install a recent R fromhttps://www.r-project.org/
Download and install a recent RStudio fromhttps://www.rstudio.com/
R>install.packages("mathml")
The package depends on R packagerolog[https://cran.r-project.org/package=rolog], which itself needs theSWI-Prolog runtime on the system. The latter can be installed eitherfrom [https://swi-prolog.org] or by installing R packagerswipl [https://cran.r-project.org/package=rswipl].
library(mathml)term <- quote(a^b + c * (d + 3) - a^2L * (a + d))mathout(term)\(a^b + c \cdot (d+3.00) - a^2 \cdot(a+d)\)
term <- call("^", quote(x), 2L)mathout(term)\(x^2\)
If you usemathml for your own package, please do not“Import”mathml in your DESCRIPTION, but “Depend” onit.
Package: onmathmlType: PackageTitle: A package that uses mathml...Depends: R (>= 4.3), mathml (>= 1.3)It’s not entirely clear why this is needed.
Installation:pack_install(mathml).
Usage:use_module(library(mathml)).
Example:pl_mathml(sin(x), X).