x
primer timepoints foldInduction
Acan 0 1.0000000
Acan 20 0.6779533
Acan 20 1.9734277
Fos 40 21.3731640
Fos 60 1.8517668
Fos 40 118.2970756
Acan 0 1.0000000
Fos 60 17.5241529
I want to 2 things 1. mean and 2. stderr of foldInduction for every primer at every time point so what I would like is a final array where the names(array) is the timepoints and the array itself are the means. Also trying to incorporate this w/ stderrs.
so for primer 'Acan' means something like this
0 20
1.0 1.325
i figured tapply might work for this. So this is what I've been doing
stderr <- function(x){sd(x,na.rm=TRUE)/sqrt(length(x))}
means <- tapply(x$foldInductions,factor(as.numeric(x$timepoints)),mean,na.rm=T)
stderrs <- tapply(x$foldInductions,factor(as.numeric(x$timepoints)),stderr)
Also, there may not be the same amount of foldInductions to average for a given timepoint but I don't think this should be a problem.
if you could help me in creating this array for one primer that would be great.