Learn R Programming

maskRangeR (version 1.1)

cropResampleTrim: Line two rasters or stacks or lists of rasters

Description

Obtain the same extents and resample to the finest resolution layer.

Usage

cropResampleTrim(expertMap, maskListRaw)

Arguments

expertMap

A binary map, either as a polygon or a raster.

maskListRaw

A list of rasters, each corresponding to layers from which masks will eventually be made (in another function).

Value

a list

Details

See Examples.

Examples

Run this code
# NOT RUN {
r1 <- raster::raster(raster::extent(c(-72, -64, 41, 50)), res = c(0.008333333, 0.008333333))
raster::values(r1) <- (1:raster::ncell(r1))^2
coords <- dismo::randomPoints(r1, 4)
polyg <- sp::SpatialPolygons(list(sp::Polygons(list(sp::Polygon(coords)),1)))
r2 <- raster::raster(raster::extent(c(-72, -64, 41, 50)), res = c(0.008333333, 0.008333333))
raster::values(r2) <- (1:raster::ncell(r2))^3
r3 <- raster::raster(raster::extent(c(-72, -64, 41, 50)), res = c(0.008333333, 0.008333333))
raster::values(r3) <- (1:raster::ncell(r3))^0.5
maskListRaw <- list(r1, r2, r3)
cropResampleTrim(expertMap = polyg, maskListRaw = maskListRaw)

# }

Run the code above in your browser using DataLab