Re: [R] For loop with ifelse help

2010-09-23 Thread Pele
Hi Sayan, This is exactly what I was looking for - it worked perfectly. Many thanks!! Also, thanks to everyone else for their suggestions. Pele -- View this message in context: http://r.789695.n4.nabble.com/For-loop-with-ifelse-help-tp2550547p2552388.html Sent from the R help mailing list ar

Re: [R] For loop with ifelse help

2010-09-23 Thread sayan dasgupta
Hi Pele, I think this should work file1$state.sum <- rowSums(file2[file1$state,6:10],0) On Thu, Sep 23, 2010 at 7:46 PM, Steve Lianoglou < mailinglist.honey...@gmail.com> wrote: > Hi Pele, > > On Wed, Sep 22, 2010 at 12:40 PM, Pele wrote: > > > > Hi David - thanks for your suggestion, but I a

Re: [R] For loop with ifelse help

2010-09-23 Thread Steve Lianoglou
Hi Pele, On Wed, Sep 22, 2010 at 12:40 PM, Pele wrote: > > Hi David - thanks for your suggestion, but I am trying to avoid doing any > merging and sorting for this step because the real file I will be working > with has about 20 million records.  If I can get this loop  or something > similar to

Re: [R] For loop with ifelse help

2010-09-22 Thread Pele
Hi David - thanks for your suggestion, but I am trying to avoid doing any merging and sorting for this step because the real file I will be working with has about 20 million records. If I can get this loop or something similar to work will be good enough. thanks again.. -- View this message

Re: [R] For loop with ifelse help

2010-09-22 Thread David Winsemius
On Sep 22, 2010, at 11:42 AM, Pele wrote: Hello R users, I have 2 files (file1 and f2) and I am trying to sum columns 6:10 of a specific row in f2 and append it in file 1 if the "state" variable in file 1 equals the rowname in f2. Below is an example of the code I wrote using a for loop,