Re: [R] how to compute when row length is different

2010-09-14 Thread rasanpreet
thank you so much Dennis...i got it[?] On Tue, Sep 14, 2010 at 7:01 AM, Dennis Murphy [via R] < ml-node+2539020-1932381782-160...@n4.nabble.com > wrote: > Hi: > > Just to be different, here's a data.table solution: > > library(data.table) > > # It's always a good idea to have your merge key vari

Re: [R] how to compute when row length is different

2010-09-14 Thread Jeff Newmiller
You need to line up the rows before you do the arithmetic. Check out ?merge "rasanpreet" wrote: > >hi guys..please help me with this >i am working on two data frames >one goes like this: >DF1 >Sample_id RepairHours Denatured Dose ZeroMean FourtyFiveMean NinetyMean >1 SDM071 0

Re: [R] how to compute when row length is different

2010-09-14 Thread Dennis Murphy
Hi: Just to be different, here's a data.table solution: library(data.table) # It's always a good idea to have your merge key variables match in each data frame/table names(DF1)[1] <- 'SampleId' dt1 <- data.table(DF1, key = 'SampleId, RepairHours') dt2 <- data.table(DF2, key = 'SampleId, RepairHo

Re: [R] how to compute when row length is different

2010-09-14 Thread Nikhil Kaza
DF3 <- merge(DF1, DF2, by=c("Sample_id", "RepairHours), all.y=T) DF3$subtract <- DF3$Day_0_Read1-DF3$ ZeroMean Nikhil Kaza Asst. Professor, City and Regional Planning University of North Carolina nikhil.l...@gmail.com On Sep 14, 2010, at 8:38 AM, rasanpreet wrote: hi guys..please help me

[R] how to compute when row length is different

2010-09-14 Thread rasanpreet
hi guys..please help me with this i am working on two data frames one goes like this: DF1 Sample_id RepairHours Denatured Dose ZeroMean FourtyFiveMean NinetyMean 1 SDM071 0 1B 60.5 19.0 45.0 2 SDM071 1 1B 46.0 23