latex2fun: Construct R function from LaTeX expression.

View source: R/latex2fun.R

latex2funR Documentation

Construct R function from LaTeX expression.

Description

Construct R function from LaTeX expression.

Usage

latex2fun(latex_string, envir = parent.frame(), na.rm = FALSE)

Arguments

latex_string

string

envir

environment

na.rm

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

Value

function

Examples

x = seq(-2 * pi, 2 * pi, length.out = 500)
f = latex2fun("\\sin{x * a}")
f_x = f(x = x, a = 2)
plot(x, f_x, type = "l")

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