[Solved] Loop R with Quandl as optional

This answer assumes reading of the earlier question and comments so is not “code only”. qt = expand.grid(Month=c(“G”,”J”,”M”,”Q”,”V”), Year=1975:2016) query_names_vec <- apply(qt, 1, function(x) paste0(“CME/GC”, paste0( x, collapse=””) ) ) > head( query_names_vec ) [1] “CME/GCG1975” “CME/GCJ1975” “CME/GCM1975” “CME/GCQ1975” [5] “CME/GCV1975” “CME/GCG1976” 10 solved Loop R with Quandl as optional