What about this?


library(prettyR)

aggregate(x, fun=Mode) 

Jacob



________________________________
From: Pieter Beck <pbeck@whrc.org>
To: r-sig-geo@r-project.org
Sent: Friday, 16 September 2011, 19:01
Subject: [R-sig-Geo] projectRaster, MAJORITY method, rather than ngb?

Dear all,

I am using raster's projectRaster to project a raster of a categorical
variable to a grid of coarser resolution (which I specify using another
raster object as the 'to' parameter). Rather than assigning the new cells
the value originally found closest to their centers (i.e. the 'ngb' method),
I'd like to assign the new cells the value originally found most commonly
within them.

I understand that such a 'majority' method is currently not part of the
projectRaster command, but would welcome suggestions for an elegant
work-around or modification to the projectRaster code.

thanks, 

Pieter


    [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
	[[alternative HTML version deleted]]

