Hi there, You do not have to use calc for that.
The following code is sufficient to replace any NA value by 0 in r r <- raster(system.file("external/test.grd", package="raster")) r[is.na(r[])] <- 0 Best Wilfried Le 10 mai 2011 à 16:21, Alfredo Alessandrini a écrit : > Hi, > > I've to replace NA value with zero in some raster. > > I use the raster package. > > Is there a faster method than this: > > funNA <- function(x) {x[is.na(x)] <- 0; return(x)} > > test <- calc(test,funNA) > > > > > Alfredo > > _______________________________________________ > R-sig-Geo mailing list > R-sig-Geo@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-geo -------------------------- Dr. Wilfried Thuiller Laboratoire d'Ecologie Alpine, UMR CNRS 5553 Université Joseph Fourier BP53, 38041 Grenoble cedex 9, France tel: +33 (0)4 76 51 44 97 fax: +33 (0)4 76 51 42 79 Email: wilfried.thuil...@ujf-grenoble.fr Personal website: http://www.will.chez-alice.fr Team website: http://www-leca.ujf-grenoble.fr/equipes/emabio.htm FP6 European MACIS project: http://www.macis-project.net FP6 European EcoChange project: http://www.ecochange-project.eu [[alternative HTML version deleted]]
_______________________________________________ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo