[R] Help with Nesting

Jeff Newmiller jdnewmil at dcn.davis.ca.us
Tue Oct 31 23:01:02 CET 2017


R does not look inside strings for language objects like your symbol variable. Nor does it magically figure out that it needs to keep previous values in a loop. And you need to be able to use valid syntax to ask clear questions in this list, so some more time with a tutorial should occur before you post again.

Perhaps:

result <- lapply( symbol, function(s) {
   Quandl( paste0( "LLL/", s ) )
}
result
-- 
Sent from my phone. Please excuse my brevity.

On October 31, 2017 12:00:41 PM PDT, Edward Guda via R-help <r-help at r-project.org> wrote:
>How do i resolve this?
>
>symbol <-  c('RRR' ,'GGG')
>
>for(i in seq_along(symbol)) {
>  dat <- Quandl("LLL/symbol[i]")
>  
>}
> 
>required solutionis a loop where Quandl is a function and it loops as
>flows,
>Quandl("LLL/RRR")
>Quandl("LLL/GGG")
>
>______________________________________________
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list