Learn R Programming

growthTrendR (version 0.2.1)

CFS_mapping: Interpolate and Map Tree-Ring Data

Description

This function performs inverse distance weighting (IDW) interpolation of tree-ring data across a spatial grid, either for all species combined or by individual species. It generates yearly interpolated raster maps over a user-defined extent or the extent of the input data.

Usage

CFS_mapping(
  data,
  year.span = c(1801, 2017),
  extent.lim = NULL,
  grid.step = 0.1,
  by.spc = FALSE
)

Value

An object of class cfs_map, a list of interpolated raster layers by species and year.

Arguments

data

input in wide format.

year.span

Numeric vector of length 2 giving the range of years to include.

extent.lim

Optional numeric vector defining the spatial extent (c(xmin, xmax, ymin, ymax)). If NULL, the extent is determined from the input data.

grid.step

Numeric value specifying the grid spacing in degrees.

by.spc

Logical; if TRUE, maps are generated by species; if FALSE, all species are combined.

Examples

Run this code

# \donttest{
# loading processed data
dt.samples_trt <- readRDS(system.file("extdata", "dt.samples_trt.rds", package = "growthTrendR"))
cols.meta = c("uid_tree", "uid_site", "longitude", "latitude", "species")
dt.mapping <- dt.samples_trt$tr_all_wide[
  , c(..cols.meta, as.character(1991:1995)), with = FALSE]
results_mapping <- CFS_mapping(dt.mapping, year.span = c(1991:1993))
# }

Run the code above in your browser using DataLab