terra (version 0.3-7)

cover: Cover (replace) NA values with values of another raster

Description

Replace NA values (or another value) in SpatRaster (x) with the values of SpatRaster (y)

Usage

# S4 method for SpatRaster,SpatRaster
cover(x, y, value=NA, filename="", overwrite=FALSE, wopt=list(), ...)

Arguments

x

SpatRaster

y

SpatRaster

value

numeric. The cell values in x to be replaced by the values in y

filename

character. Output filename. Optional

overwrite

logical. If TRUE, filename is overwritten

wopt

list. Options for writing files as in writeRaster

...

additional arguments. None implemented

Value

SpatRaster

Examples

Run this code
# NOT RUN {
r1 <- r2 <- rast(ncols=36, nrows=18)
values(r1) <- 1:ncell(r1)
values(r2) <- runif(ncell(r2))
r2 <- classify(r2, cbind(-Inf, 0.5, NA))
r3 <- cover(r2, r1)
# }

Run the code above in your browser using DataLab