Say I have a function called
myfun <- function(x,y) {median(x,y)}
Now, say for some use, the parameter y is constant, say c(1,2,3,4,5) ). Is there a way I can apply this without transferring it to another function? i.e
instead
apply(mydf, 2, function(x) myfun(x, c(1,2,3,4,5)))
pass something like
apply(mydf, 2, myfun(,(c(1,2,3,4,5))))
This is purely cosmetic, and I know that it will not make much difference to the operating time. I just want to know if such an option is possible, because every time my function in a function seems to be ineffective.
source share