Skip to content
Prev 313419 / 398502 Next

Latitudinal mean of values in a data frame

Hi,
In addition, you can also use:
?trunc(), ?substr() etc.

?aggregate(Value, by = list(floor(Lat)), FUN = function(x) signif(mean(x),2))
#? Group.1??? x
#1????? 69 0.18
#2????? 70 0.16


? aggregate(Value, by = list(substr(Lat,1,2)), FUN = function(x) signif(mean(x),2))
#? Group.1??? x
#1????? 69 0.18
#2????? 70 0.16

?aggregate(Value, by = list(trunc(Lat)), FUN = function(x) signif(mean(x),2)) 
?Group.1??? x
#1????? 69 0.18
#2????? 70 0.16
A.K.


----- Original Message -----
From: Rui Barradas <ruipbarradas at sapo.pt>
To: Swagath Navin <s.n.manohar at rug.nl>
Cc: r-help at r-project.org
Sent: Tuesday, December 11, 2012 10:27 AM
Subject: Re: [R] Latitudinal mean of values in a data frame

Hello, again.

Another possibility is

aggregate(Value, by = list(floor(Lat)), FUN = mean)

Rui Barradas
Em 11-12-2012 11:17, Swagath Navin escreveu:
______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.