Try this: sapply(ls(pattern = 'Table[0-9]'), get)
On Sat, Sep 19, 2009 at 7:51 PM, tzygmund mcfarlane <tzygm...@googlemail.com> wrote: > Jorge, > > Your suggestions produce the names of the matrices and not the > contents. Sorry if this was not clear in the question. > > > > On Sat, Sep 19, 2009 at 11:46 PM, Jorge Ivan Velez > <jorgeivanve...@gmail.com> wrote: >> Dear tzygmund, >> Here are two suggestions: >> # Suggestion 1 >> for (i in 1:10){ >> disp<-paste("Table", i, sep="") >> print(get(disp)) >> } >> # Suggestion 2 >> disp <- paste("Table", 1:10, sep="") >> sapply(disp, function(x) print( get(x) ) ) >> See ?print and ?get for more information. >> HTH, >> Jorge >> >> On Sat, Sep 19, 2009 at 6:40 PM, tzygmund mcfarlane <> wrote: >>> >>> Hi, >>> >>> I am unable to do something fairly simple. I have matrices called >>> Table1,..., Table10. I want to be able to print them using a loop. So >>> I wrote: >>> ################## >>> for (i in 1:10){ >>> disp<-paste("Table", i, sep="") >>> eval(parse(text=disp)) >>> } >>> ################## >>> but this produces no output. Any ideas? >>> >>> ______________________________________________ >>> 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. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O ______________________________________________ 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.