Lets say I have a function that fetches data from Yahoo called Yahoo.Fetch, and I run a do.call on the function, which would be:
do.call(merge.xts, lapply(list.of.tickers, Yahoo.Fetch))
The default would have all=TRUE
in merge.xts
, so how would I be able to specify in a do.call to have all=FALSE
? This is just an example, but I would like to know how to change and specify parameters in apply, do.call, lapply functions.
You can add it as a named value to the existing list with c()
which returns another list:
do.call(merge.xts, c( lapply(list.of.tickers, Yahoo.Fetch), all=FALSE ))
Or wrap the parameter in with an anonymous helper function:
do.call( function(x) merge.xts(x, all=FALSE),
lapply(list.of.tickers, Yahoo.Fetch))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With