R Selecting only up to maxmimum -
i want calculate mean of acceleration values displacement value of 0.01 max. however, not want include acceleration values after maximum value. how done?
mean( subset(s1_intns40_chainno-sheet1, displacement>0.01:max(displacement), select=c("acceleration"))$acceleration) [1] -0.8371687
like so:
limitedavgacc <- mean(data$acceleration[(data$displacement <= max)&(data$displacement >= 0.01)])
this works because bracketed statement create boolean vector, used subset acceleration vector, averaged.
Comments
Post a Comment