Thanks for the help. Sharad On Mon, Sep 27, 2010 at 9:12 PM, Remko Duursma [via R] < ml-node+2716469-935075351-6...@n4.nabble.com<ml-node%2b2716469-935075351-6...@n4.nabble.com> > wrote:
> Try something like this: > > > > dfr <- read.table(textConnection(" plate.id well.id Group HYB > rlt1 > 1 P1 A1 Control SKOV3hyb 0.190 > 2 P1 A2 Control SKOV3hyb 0.210 > 3 P1 A3 Control SKOV3hyb 0.205 > 4 P1 A4 Control SKOV3hyb 0.206 > 5 P1 A5 Control SKOV3hyb 0.184 > 385 P1 A1 ovca SKOV3hyb 0.184 > 386 P1 A2 ovca SKOV3hyb 0.229 > 387 P1 A3 ovca SKOV3hyb 0.214 > 388 P1 A4 ovca SKOV3hyb 0.226 > 389 P1 A5 ovca SKOV3hyb 0.217 ")) > > > difs <- lapply(split(dfr,dfr$plate.id), function(x)x$rlt1[x$Group == > "Control"] - x$rlt1[x$Group == "ovca"]) > dfr$Diff <- Reduce(c,difs) > > > > greetings, > Remko > > ------------------------------ > View message @ > http://r.789695.n4.nabble.com/subtraction-based-on-two-groups-in-a-dataframe-tp2716104p2716469.html > To unsubscribe from subtraction based on two groups in a dataframe, click > here<http://r.789695.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=2716104&code=c2JwdXJvaGl0QGdtYWlsLmNvbXwyNzE2MTA0fDU4ODg0MTYwOQ==>. > > > -- View this message in context: http://r.789695.n4.nabble.com/subtraction-based-on-two-groups-in-a-dataframe-tp2716104p2719364.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.