You can use the apply function which "applies" a function of your
choice, and
MARGIN = 2 means you want to do it columnwise:
> apply(X = df, MARGIN=2, FUN = mean, na.rm = TRUE)
Latitude Longitude January February March April May
June
26.9380 -109.8125 159.8454 156.4489 153.6911 150.1719 148.0885
149.2365 > apply(X = df, MARGIN=2, FUN = min, na.rm = TRUE)
Latitude Longitude January February March April May
June
26.938 -110.688 121.204 118.713 117.293 114.398 112.357
113.910 > apply(X = df, MARGIN=2, FUN = max, na.rm = TRUE)
Latitude Longitude January February March April May
June
26.938 -108.938 252.890 248.991 244.870 241.194 239.615
239.888 > apply(X = df, MARGIN=2, FUN = median, na.rm = TRUE)
Latitude Longitude January February March April May
June
26.9380 -109.8120 134.5990 130.7960 127.4495 123.2100 120.8375
122.3835
--
View this message in context:
http://r.789695.n4.nabble.com/Calculating-mean-median-minimum-and-maximum-tp4700862p4700946.html
Sent from the R help mailing list archive at Nabble.com.