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 this message in context: 
http://r.789695.n4.nabble.com/subtraction-based-on-two-groups-in-a-dataframe-tp2716104p2716469.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
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.

Reply via email to