One the one hand I have a function which has the components of a vector as arguments. This function is like this one:
y_fun = function( x1, x2, x3, x4 ) 2*x1 + x2*x3*log( x4 )
On the other hand I do not have the components
x1, x2, x3, x4
but, only the vector (with these components) given by:
vect = c(x1, x2, x3, x4)
It is not very practical for my purpose to type in, one after the other, the values of the vector's components into the arguments of the function. How is it possible to evaluate the function over the elements of a given vector? I tried this (without success):
y_fun( as.list( vect ) )
and this
elements = noquote( paste0( vect, collapse = ",") )
y_fun( elements )