selectLatestCovariates: Select the lastest layer for each covariate in a nested list.

Description Usage Arguments Value See Also Examples

Description

From a named list containing synoptic and temporally resolved covariate layers, build a stack containing only the latest layer for each covariate (highest date).

Usage

1

Arguments

covariates

A named list of containing RasterLayer objects (or file paths), or sublists of RasterLayer (or file paths) for temporally resolved covariates. Synoptic covariates should have an entry with an approriate name and the RasterLayer (or file paths) as it's value. Annually resolved covariates should have an entry with an approriate name and a sub-list of files as it's value. The sub-list should name names in the format "YYYY", and values which are the RasterLayer (or file paths) of each covariate layer. Monthly resolved covariates should be structured in the same way as annual covariates, but use the format "YYYY-MM". Daily resolved covariates should be structured in the same way as annual covariates, but use the format "YYYY-MM-DD".

load_stack

(Optional) A function which creates a stack from list of file paths. This can be used to override the crs and/or extent read from the files. Default is raster::stack.

Value

A RasterStack with a named layer for each covariate.

See Also

extractBatch

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# load occurrence data, admin units and covariates
data(covariates)
layers <- list(
  "cov1"=raster(covariates, layer="cov_a"),
  "cov2"=raster(covariates, layer="cov_b"),
  "cov3"=list(
    "2012"=raster(covariates, layer="cov_a"),
    "2013"=raster(covariates, layer="cov_b"),
    "2014"=raster(covariates, layer="cov_c")
  ),
  "cov4"=list(
    "2012"=raster(covariates, layer="cov_c"),
    "2013"=raster(covariates, layer="cov_b"),
    "2014"=raster(covariates, layer="cov_a")
  ),
  "cov5"=list(
    "2012-01"=raster(covariates, layer="cov_a"),
    "2012-02"=raster(covariates, layer="cov_b"),
    "2012-03"=raster(covariates, layer="cov_c")
  ),
  "cov6"=list(
    "2012-01"=raster(covariates, layer="cov_a"),
    "2012-02"=raster(covariates, layer="cov_b"),
    "2012-03"=raster(covariates, layer="cov_c")
  )
)

# extract all covariates,
stack <- selectLatestCovariates(layers)

SEEG-Oxford/seegSDM documentation built on May 9, 2019, 11:08 a.m.