[R] How to skip negative values when calculating average

ecvetano at uwaterloo.ca ecvetano at uwaterloo.ca
Mon May 31 20:06:40 CEST 2010


I have a data frame 10 by 12 with positive and negative numbers. I  
want to select only the positive numbers and find the average.

This calculates the average of everything:
av5 <-  subset(ER9r, Day == 253, select = c (Depth1j:Depth0.75j)
av5 <- mean(av5)
I need something along the lines of "select" av5>0

Thanks in advance!

Emilija



More information about the R-help mailing list