downsample {voluModel} | R Documentation |
Occurrence downsampling
Description
Reduces number of occurrences to resolution of input raster
Usage
downsample(occs, rasterTemplate, verbose = TRUE)
Arguments
occs |
A |
rasterTemplate |
A |
verbose |
|
Value
A data.frame
with two columns named "longitude"
and "latitude" or with names that were used when coercing
input data into this format.
Examples
library(terra)
# Create sample raster
r <- rast(ncol=10, nrow=10)
values(r) <- 1:100
# Create test occurrences
set.seed(0)
longitude <- sample(ext(r)[1]:ext(r)[2],
size = 10, replace = FALSE)
set.seed(0)
latitude <- sample(ext(r)[3]:ext(r)[4],
size = 10, replace = FALSE)
occurrences <- as.data.frame(cbind(longitude,latitude))
# Here's the function
result <- downsample(occs = occurrences, rasterTemplate = r)
[Package voluModel version 0.2.1 Index]