I am running multiple univariate regressions, like in this reproducible example:
require(dynlm) data(USeconomic) US<-USeconomic vars<-colnames(US)[-2] a<
To construct R formula, you must paste it all together, not just the predictor side of it. So you need something like:
formula <- as.formula( paste("log(GNP)~", paste("L(",rep(vars,each=3),",",l,")",sep=""), sep = "" ) )
and then run
dynlm(formula, data = ...)