Dear list,

I have a RasterLayer as follows

class       : RasterLayer
band        : 1  (of  365  bands)
dimensions  : 1032, 1656, 1708992  (nrow, ncol, ncell)
resolution  : 0.04166667, 0.04166667  (x, y)
extent      : 96.5, 165.5, -16.5, 26.5  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84
+towgs84=0,0,0
data source : ...\2012.tif
names       : X2012
values      : 16.75, 34.35  (min, max)


I tried to extract the annual maximum image using :
fun1 <- function(x){
         m <- max(x)
         w <- which(max(x) == x)
         return(c(m, w))
         }
s2 <- calc(stack, fun = fun1)

but end up with this error message :
Error in setValues(out, x) :
  values must be numeric, integer, logical or factor

I am not sure where I went wrong as the min and max values are 1.75 and
34.35.

Anybody?

Thanks in advance.

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to