Re: [R] Merge records in the same dataframe

2009-11-05 Thread jim holtman
Try something like this: # get column numbers of 'wk' columns col.num <- grep("^wk", names(yourDF)) # split out only the 'wk' columns result <- lapply(split(yourDF[, col.num], paste(yourDF$x2, paste(yourDF$x3))), function(.mrg){ colSums(.mrg) }) On Thu, Nov 5, 2009 at 4:15 PM, Vadlamani, Sat

Re: [R] Merge records in the same dataframe

2009-11-05 Thread Peter Alspach
Tena koe Satish I'm not entirely sure what you want, but did you check aggregate()? HTH Peter Alspach > -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Vadlamani, > Satish {FLNA} > Sent: Friday, 6 November 2009 10:16 a