Learn R Programming

dMod (version 0.1)

funC0: Evaluation of algebraic expressions defined by characters

Description

Evaluation of algebraic expressions defined by characters

Usage

funC0(x, compile = TRUE)

Arguments

x
Name character vector, the algebraic expressions
compile
Logical. The function is either compiled (requires the inline package) or evaluated in raw R.

Value

  • A prediction function f(mylist) where mylist is a list of numeric vectors that can be coerced into a matrix. The names correspond to the symbols used in the algebraic expressions. The function f returns a matrix.

Examples

Run this code
myfun <- funC0(c(x = "x", y = "a*x^4 + b*x^2 + c"))
out <- myfun(list(a = -1, b = 2, c = 3, x = seq(-2, 2, .1)))
plot(out[, 1], out[, 2])

Run the code above in your browser using DataLab