Hi,
thanks for providing this great package!
I am trying to call irf(VAR) from inside a function with dynamic argument(s):
f1 <- function(max_lag = 6){
vars::irf(vars::VAR(EuStockMarkets, lag.max = get("max_lag", env = parent.frame())))
}
f1(max_lag = 12)
This results in
Error in get("max_lag", env = parent.frame()) :
object 'max_lag' not found
I presume the issue has something to do with the definition of the environments in irf() or VAR(). I played around with the env argument but to little avail. Maybe this is helpful?