[R] Apply a multi-variable function to a vector
stevek9123 at gmail.com
Fri Sep 9 21:50:59 CEST 2016
I would like to define an arbitrary function of an arbitrary number of
variables, for example, for 2 variables:
func2 <- function(time, temp) time + temp
I'd like to keep variable names that have a meaning in the problem (time
and temperature above).
If I have a vector of values for these variables, for example in the 2-d
case, c(10, 121), I'd like to apply my function (in this case func2) and
obtain the result. Conceptually, something like,
Is there a simple way to accomplish this, for an arbitrary number of
variables? I’d like something that would simply work from the definition
of the function. If that is possible.
[[alternative HTML version deleted]]
More information about the R-help