In short, don't -- use a named list instead. Long answer:
?assign ?get Michael On Tue, Feb 28, 2012 at 10:40 PM, michaelyb <cel81009...@gmail.com> wrote: > Hello, > > I am trying to use a for loop to name objects in each iteraction. As in the > following example (which doesn't work quite well) > > my_list<-c("A","B","C","D","E","F") > for(i in c(1:length(my_list))){ > url<- "http://finance.yahoo.com" > doc = htmlTreeParse(url, useInternalNodes = T) > tab_nodes = xpathApply(doc, "//table[@cellpadding = '3']") > *my_list[i]*=lapply(tab_nodes, readHTMLTable) #problem is in this line > names(*my_list[i]*)=c("Ins","outs") > } > > The problem is that in iteraction #1, I need the info to be stored at an > object called "A"; At iteraction #2 at object called "B"... and so on.... > > Any idea/help? > > thank you in advance! > > -- > View this message in context: > http://r.789695.n4.nabble.com/Using-a-FOR-LOOP-to-name-objects-tp4430454p4430454.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@r-project.org mailing list > 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. ______________________________________________ R-help@r-project.org mailing list 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.