funC0 {dMod} | R Documentation |
Evaluation of algebraic expressions defined by characters
Description
Evaluation of algebraic expressions defined by characters
Usage
funC0(
x,
variables = getSymbols(x, exclude = parameters),
parameters = NULL,
compile = FALSE,
modelname = NULL,
verbose = FALSE,
convenient = TRUE,
warnings = TRUE
)
Arguments
x |
Object of class |
variables |
character vector, the symbols that should be treated as variables |
parameters |
character vector, the symbols that should be treated as parameters |
compile |
Logical. Directly compile the file. If |
modelname |
file name of the generated C file. See description of parameter |
verbose |
Print compiler output to R command line. |
convenient |
logical, if TRUE return a function with argument |
warnings |
logical. Suppress warnings about missing variables/parameters that are automatically replaced by zero values. |
Value
Either a prediction function f(..., attach.input = FALSE)
where the
variables/parameters are passed as named arguments or a prediction function
f(M, p, attach.input = FALSE)
where M
is the matrix of variable values
(colums with colnames correspond to different variables) and p
is the vector of
parameter values.
The argument attach.input
determines whether M
is attached to the output.
The function f
returns a matrix.
Examples
library(ggplot2)
myfun <- funC0(c(y = "a*x^4 + b*x^2 + c"))
out <- myfun(a = -1, b = 2, c = 3, x = seq(-2, 2, .1), attach.input = TRUE)
qplot(x = x, y = y, data = as.data.frame(out), geom = "line")