[STATSGRASS] mode in R

Roger Bivand Roger.Bivand at nhh.no
Wed May 24 02:33:56 EDT 2006


On Tue, 23 May 2006, Carlos "Guâno" Grohmann wrote:

> This should be really silly, but if I have a raster map that I loaded
> into R, how can I get the mode of the raster values?

If the raster is a CELL, that is integer or categorical, you can tabulate 
the unique values (but even so, there may be multiple modes). If it is 
FCELL or DCELL, the mode is not well defined, because it depends on the 
resolution of your observations on the real line. There have been several 
discussions of this on R-help, see RSiteSearch("mode") or in particular 
the thread including:

http://finzi.psych.upenn.edu/R/Rhelp02a/archive/13990.html

using kernel densities to attack the problem.

Roger

> 
> tks
> 
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no





More information about the grass-stats mailing list