View source: R/inputProcessingUtilties.R
downsample | R Documentation |
Reduces number of occurrences to resolution of input raster
downsample(occs, rasterTemplate, verbose = TRUE)
occs |
A |
rasterTemplate |
A |
verbose |
|
A data.frame
with two columns named "longitude"
and "latitude" or with names that were used when coercing
input data into this format.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.