Displaying 2 results from an estimated 2 matches for "timedif".
Did you mean:
timediff
2011 Aug 18
3
Coding question for behavioral data analysis
Hello all,
I have a question which I have been struggling with for several weeks
now, that I think might be easy for more proficient coders than
myself. I have a large behavioral dataset, with behaviors and the
times (milliseconds) that they occurred. Each subject has a separate
file, and a sample subject file can be generated using the following
syntax:
Time <- c(1000, 1050, 1100, 1500, 2500,
2012 Mar 19
2
by output into data frame
...mple!='morning after')
lab.samples$Sample<-factor(lab.samples$Sample)
lab.samples.stress<-subset(lab.samples,challenge=='stress')
lab.samples.control<-subset(lab.samples,challenge=='control')
auc_ground <- function(sub_df) {
print(sub_df)
auc<-sub_df[1,]*0
timedif<-c(60,10,10,10,10,10,10)
for (i in 1:(nrow(sub_df)-1) ) {
print(c(i,i+1))
#print(c(values[i],values[i+1]))
pair_area<-(sub_df[i,]+sub_df[i+1,])*timedif[i]/2
auc<-auc+pair_area
}
auc
}
auc_stress<-by(lab.samples.stress[c('cortisol','amylase')], lab.samples.str...