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

jquery - How do you format the date used in the popover widget title of FullCalendar? -

Bubble Sort Manually a Linked List in Java -

asp.net mvc - SSO between MVCForum and Umbraco7 -