Re: [R] Using changing names in loop in R

2010-11-08 Thread Tuatara
Josh, thanks so much for your detailed reply. This is exactly what I was looking for. -- View this message in context: http://r.789695.n4.nabble.com/Using-changing-names-in-loop-in-R-tp3030132p3031899.html Sent from the R help mailing list archive at Nabble.com. _

Re: [R] Using changing names in loop in R

2010-11-06 Thread Joshua Wiley
On Sat, Nov 6, 2010 at 3:13 PM, Tuatara wrote: > > A more detailed example: > > Say I would like to read in data files that are set-up identically and have > identical (but somewhat) different text names (see below): > > data_1 <- read.csv("data1.txt") > data_2 <- read.csv("data2.txt") > data_3 <-

Re: [R] Using changing names in loop in R

2010-11-06 Thread Tuatara
A more detailed example: Say I would like to read in data files that are set-up identically and have identical (but somewhat) different text names (see below): data_1 <- read.csv("data1.txt") data_2 <- read.csv("data2.txt") data_3 <- read.csv("data3.txt") How do I automate this process? (I ass

Re: [R] Using changing names in loop in R

2010-11-06 Thread Joshua Wiley
Hi, If you have data that is similar enough to warrant only changing the extension (i.e., 1, 2, etc.) and that you (at least at times) wish to perform operations on together, it is time to start thinking of a more flexible framework. Fortunately, such a framework already exists in lists. Lists l

Re: [R] Using changing names in loop in R

2010-11-06 Thread Liviu Andronic
On Sat, Nov 6, 2010 at 5:22 PM, Tuatara wrote: > > Hello everybody, > > I have usually solved this problem by repeating lines of codes instead of a > loop, but it's such a waste of time, I thought I should really learn how to > do it with loops: > Would the following construct help? > for(i in 1:

Re: [R] Using changing names in loop in R

2010-11-06 Thread Daniel Nordlund
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Tuatara > Sent: Saturday, November 06, 2010 9:22 AM > To: r-help@r-project.org > Subject: [R] Using changing names in loop in R > > > Hello everybody,

[R] Using changing names in loop in R

2010-11-06 Thread Tuatara
Hello everybody, I have usually solved this problem by repeating lines of codes instead of a loop, but it's such a waste of time, I thought I should really learn how to do it with loops: What I want to do: Say, I have several data files that differ only in a number, e.g. data points (or vector