Suppose you have a function f<- function(x,y,z) { ... }. How would you go about passing a constant to one argument, but letting the other ones vary? In other words, I would like to do something like this:
output <- outer(x,y,f(x,y,z=2))
This code doesn’t evaluate, but is there a way to do this?
The arguments after the function are additional arguments to it, see
...in?outer. This syntax is very common in R, the wholeapplyfamily works the same for instance.Update:
I can’t tell exactly what you want to accomplish in your follow up question, but think a solution on this form is probably what you should use.
This calculates a variance matrix for each combination of the values in
sigma_intandtheta_int, uses that matrix to define a dennsity and evaluates it in the point(s) defined iny. I haven’t been able to test it though since I don’t know the types and dimensions of the variables involved.