sample_region_series: Sample points from a region time series

View source: R/sample_region_series.R

sample_region_seriesR Documentation

Sample points from a region time series

Description

This function samples points from a region time series. Sampling can either be performed for the same locations at all time steps (if only one value is given for size), or for different locations for each time step (if size is a vector of length equal to the number of time steps). To sample the same number of points, but different locations, for each time step, provide a vector repeating the same value for each time step.

Usage

sample_region_series(x, size, method = "random", replace = FALSE, na.rm = TRUE)

Arguments

x

a terra::SpatRasterDataset returned by region_series()

size

number of points sampled. A single value is used to sample the same locations across all time steps, a vector of values to sample different locations at each time step.

method

one of the sampling methods from terra::spatSample(). It defaults to "random"

replace

boolean determining whether we sample with replacement

na.rm

boolean determining whether NAs are removed

Details

This function wraps terra::spatSample() to appropriate sample the terra::SpatRasters in the terra::SpatRasterDataset returned by region_series().

Value

a data.frame with the sampled cells and their respective values for the climate variables.


EvolEcolGroup/pastclim documentation built on Nov. 8, 2024, 5:21 a.m.