R/DataPreparation.R
Prepare_covarStack.Rd
Merge covariate rasters from different extents and projections into a multi-layer Raster
Prepare_covarStack( cov.paths, r.ref, ext, outWD, names.cov, is.factor, verbose = 1, cl = NULL )
cov.paths | vector of paths of all raster files to be added in the multi-layer raster |
---|---|
r.ref | Raster used as a reference for extent, resolution, crs. Default is the first one of the list. |
ext | Optional object of class extent to crop r.ref before stack. |
outWD | Directory where to save new reprojected, cropped rasters. Default to "tempdir()/extent". |
names.cov | Optional. vector of names of multi-layer raster. Same length as x. |
is.factor | position of covariates that are factors or categories. Resampling (if required) is bilinear by default but "ngb" (nearest neighbour) for factors. |
verbose | level of messages shown |
cl | a cluster as made with |
Rasters are merged in a unique RasterStack. If the projection of a raster is different than the reference (r.ref), it is reprojected. If the extent is different, it is resampled. If the resolution is smaller than 0.9*res, it is first aggregated, then resampled. Method depends if projection is really different, otherwise this is only a change in name of proj