Skip to contents

stm_fexpr_vars() identifies and extracts unique variable names from a string representation of a mathematical expression. Mathematical functions such as sqrt, log, and others are excluded from the output.

Usage

stm_fexpr_vars(fexpr)

Arguments

fexpr

A character string representing a mathematical expression. It should be a valid expression with variables and functions.

Value

A character vector of unique variable names found in the expression. Mathematical functions are excluded from the result.

See also

stm_function, stm_fexpr_vars

Examples

expr <- "x^2 + y * sqrt(z)"
stm_fexpr_vars(expr)
#> [1] "x" "y" "z"

expr <- "log(a) + sin(b) + 3 * pi"
stm_fexpr_vars(expr)
#> [1] "a" "b"