I am used to use apply familiy functions to avoid for loop with R. In this context I was wondering it there is a way to avoid typing a bound variable. For example, say I want to do 100 times an operation do.call(myfun, args). With for I'd write:
res = seq(100)
for(i in seq(100)){res[i] = do.call(myfun, args)}
with apply I type:
res = sapply(seq(100), function(i) do.call(myfun, args))
I understand that sapply tries to apply the function to one argument, it is an element of seq(100), but is there a way to avoid this, because indeed this variable (here i) has no meaning neither utility ?
thanks for the insight