Re: [R] Processing strings

2009-09-19 Thread tzygmund mcfarlane
Thanks again! On Sun, Sep 20, 2009 at 12:04 AM, Jorge Ivan Velez wrote: > Hi tzygmund, > You can avoid the print() part and the result would be pretty much the same: > # Data > x1 <- x2<- x3 <- matrix( rnorm(20), ncol = 5) > # Names to print > Names <- paste('x', 1:3, sep="") > # New suggestion >

Re: [R] Processing strings

2009-09-19 Thread Jorge Ivan Velez
Hi tzygmund, You can avoid the print() part and the result would be pretty much the same: # Data x1 <- x2<- x3 <- matrix( rnorm(20), ncol = 5) # Names to print Names <- paste('x', 1:3, sep="") # New suggestion sapply( Names, function( y ) list( get( y ) ) ) Best, Jorge On Sat, Sep 19, 2009 a

Re: [R] Processing strings

2009-09-19 Thread Henrique Dallazuanna
Try this: sapply(ls(pattern = 'Table[0-9]'), get) On Sat, Sep 19, 2009 at 7:51 PM, tzygmund mcfarlane 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 V

Re: [R] Processing strings

2009-09-19 Thread tzygmund mcfarlane
Ah, apologies. In the backing and forthing, I assigned the names to the matrices. All sorted. Thanks! On Sat, Sep 19, 2009 at 11:55 PM, Duncan Murdoch wrote: > On 19/09/2009 6:51 PM, tzygmund mcfarlane wrote: >> >> Jorge, >> >> Your suggestions produce the names of the matrices and not the >> con

Re: [R] Processing strings

2009-09-19 Thread Duncan Murdoch
On 19/09/2009 6:51 PM, tzygmund mcfarlane wrote: Jorge, Your suggestions produce the names of the matrices and not the contents. Sorry if this was not clear in the question. You must not have entered them correctly. His answer is fine. Duncan Murdoch On Sat, Sep 19, 2009 at 11:46 PM, Jo

Re: [R] Processing strings

2009-09-19 Thread tzygmund mcfarlane
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 wrote: > Dear tzygmund, > Here are two suggestions: > # Suggestion 1 > for (i in 1:10){ >  disp<-paste("Table", i, sep

Re: [R] Processing strings

2009-09-19 Thread Jorge Ivan Velez
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, 20

[R] Processing strings

2009-09-19 Thread tzygmund mcfarlane
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