[R] Merge and join data
Sean M. Lucey
slucey at mercury.wh.whoi.edu
Wed Jan 20 21:19:37 CET 2010
Hi,
I'm looking to combine two data frames. Several of the columns are in
common while the others need to be summed up. The apply functions and
the merge functions don't seem to be working. I've included a basic
example of what I'm trying to do below. Thanks!
Sean
data.frame1<-as.data.frame(matrix(c('winter','dredge','515',100,150),1,5))
names(data.frame1)<-c('Season','Gear','Area','COD','POLL')
data.frame2<-as.data.frame(matrix(c('winter','dredge','515',13,24,18),1,6))
names(data.frame2)<-c('Season','Gear','Area','COD','POLL','HAD')
I'd like to end up with something that looks like this:
Season Gear Area COD POLL HAD
winter dredge 515 113 174 18
Thanks,
Sean
More information about the R-help
mailing list