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

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -