I am using the package raster to work with GeoTIFF raster files which I exported from GRASS using r.out.gdal. GRASS assigned the value -nan to some raster files (type FLOAT32) for missing values. Other files had 65535 or 255 assigned to missing values.
In R, I reassign these values to missing like this:
raster[raster==255] <- NA
The problem is that I do not know what to do with multiple rasters that had the
-nan assigned to missing values. For what I see when I examine the structure of these rasters (which I have as part of a list), the -nan are stored as NaN.I tried doing:
rasterlist[["element_i"]][rasterlist[["element_i"]] == NaN] <- NA
but I do not see any difference, for example when I do:
The output is something like:
8100 NaN 8101 NaN NaN 8102 8104 8106
so the NaN are not transformed into NA.