I have a data frame containing the results of time measurements taken from
several cells. Each cell was measured in conditions A and B, and there are
an arbitrary number of measurements in each condition. I am trying to
calculate the difference of each measurement from the mean of a given cell
in a given condition without relying on loops.

>my.df
           id       cond    time
1         cell1     A       343.5
2         cell1     A       355.2
...
768      cell1     B       454.0
...
2106    cell2     A       433.9
...

as a first approach I tried:

> mews<-aggregate(my.df$time, list(cond=data$id, id=data$cond), mean)
id      cond      time
cell1    A         352
cell1    B         446
cell2    A         244
cell2    B         ...

I then tried to use %in% to match id and cond of mews with my.df, but I
haven't been able to get it to work.
Am I on the right track? What are some other solutions?

Thanks for any help.

jason


-- 
View this message in context: 
http://n4.nabble.com/a-vectorized-solution-to-some-simple-dataframe-math-tp1692810p1692810.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