raster (version 1.1.7)

cover: Cover

Description

Replace NA values in the first RasterLayer (x) with the values of the second RasterLayer (y), and so forth for additional RasterLayers.

Arguments

Value

  • A new RasterLayer object, and in some cases the side effect of a new file on disk.

Details

The function returns a RasterLayer with the values of the second RasterLayer (y) where the first RasterLayer (x) has NA values, and the values of the first RasterLayer elsewhere. rll{ format Character. Output file type. See writeRaster datatype Character. Output data type. See dataType overwrite If TRUE, "filename" will be overwritten if it exists progress Character. Valid values are "text", "tcltk", "windows" (on that platform only) and "" }

Examples

Run this code
r1 <- raster(ncols=36, nrows=18)
r1[] <- 1:ncell(r1)
r2 <- setValues(r1, runif(ncell(r1)))
r2[r2<0.5] <- NA
r3 <- cover(r2, r1)

Run the code above in your browser using DataCamp Workspace