[R-sig-Geo] Help on extracting min/max from raster object

Robert Hijmans r.hijmans at gmail.com
Tue Mar 1 17:55:01 CET 2011


Rahul,

> > > I wanted to extract the min value and max value from 
> > the object. How can I 
> > > do this? 
> > > I have used the following function for this purpose 
> > > > cellStats(r,'min') 
> > > [1] 0 
> > > 
> > > But it is returning 0, not "0.001407638" 

The combination of 

minValue(r)
[1] 0.001407638
> cellStats(r, min) 
[1] 0 

Suggests to me that the minimum value reported by the file is incorrect. 

You may first want to do:

r <- setMinMax(r)
# this should be TRUE
minValue(r) == cellStats(r, min)

Robert

-- 
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Help-on-extracting-min-max-from-raster-object-tp6077015p6077904.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list