latex2r: Translate LaTeX formula to R code.

View source: R/latexr.R

latex2rR Documentation

Translate LaTeX formula to R code.

Description

Take a LaTeX formula and attempts to find an equivalent representation in R. If interactive=TRUE it pops up an interactive REPL that does the same, but interactively.

Usage

latex2r(x, interactive = FALSE, na.rm = FALSE)

Arguments

x

string

interactive

boolean

na.rm

boolean; when TRUE, calls to mean() and median() are emitted with na.rm = TRUE.

Value

string

Examples

latex2r("\\beta_1^{\\frac{x+1}{x^2 \\cdot y}}")
latex2r("\\bar{x}", na.rm = TRUE)

latexr documentation built on Sept. 30, 2026, 5:08 p.m.