Re: [R] paste data

2008-06-18 Thread Ido M. Tamir
>I want to do very similar things with all the dataframes and their structure >is also the same. >Is there a way to write a loop? (so that I don't have to write the same 18 >times) >I tried things like that: >for (x in 1:length(plot)) >{ > plot(paste("auto.",plot[x],sep="")[,1], > pas

Re: [R] paste data

2008-06-18 Thread Ray Brownrigg
get() is your friend. Try: for (x in 1:length(plot)) { thisdf <- paste("auto.", plot[x], sep="") plot(thisdf[, 1], thisdf[, 2], col=...) } HTH, Ray Brownrigg Sybille Wendel wrote: Hello, I need a command. I have a lot of data in different dataframes(auto.0a, auto.0b, auto.0c,

Re: [R] paste data

2008-06-18 Thread Peter Dalgaard
Sybille Wendel wrote: > Hello, > > I need a command. > I have a lot of data in different dataframes(auto.0a, auto.0b, auto.0c, > auto.5Na,...), that has similar names. > > I could print the names all at once wih a loop with the command paste(), see > below: > > plot<-c("0a","0b","0c","5Na","5Nb",

Re: [R] paste data

2008-06-18 Thread Hans-Joerg Bibiko
On 18 Jun 2008, at 10:36, Sybille Wendel wrote: I need a command. I have a lot of data in different dataframes(auto.0a, auto.0b, auto. 0c, auto.5Na,...), that has similar names. I could print the names all at once wih a loop with the command paste(), see below: plot<- c("0a","0b","0c","5

Re: [R] paste data

2008-06-18 Thread Søren Højsgaard
You can put all dataframes into a list L, e.g. L <- list(auto.0a, auto.0b,...) and then do either a for-loop or use lapply. For example for (ii in 1:length(L)){ plot(y~x, data=L[[ii]],...) } or lapply(L, function(d) plot(y~x, data=d) Med venlig hilsen Søren Højsgaard -Oprindel