[R] Using "mean" if two values are identical
jbarnier at ens-lsh.fr
Thu Apr 19 16:11:34 CEST 2007
> I've got a matrix (mail end) with the colnames x, y, z. In this matrix
> are different measurements. x and y are risign coordinates.
> My question. Always, if the "x" AND "y" coordinates are the same, I want to
> get the mean of their z values.
Maybe you could try with the aggregate function, for example :
aggregate(INPUT[,3], by=list(INPUT[,1],INPUT[,2]), FUN=mean)
Hope that helps,
Groupe de recherche sur la socialisation
ENS-LSH - Lyon, France
More information about the R-help