move: Move records to closest non-NA cell.

Description Usage Arguments Details Value Examples

View source: R/red.R

Description

Identifies and moves presence records to cells with environmental values.

Usage

1
move(longlat, layers, buffer = 0)

Arguments

longlat

Matrix of longitude and latitude or eastness and northness (two columns in this order) of species occurrence records.

layers

Raster* object as defined by package raster.

buffer

Maximum distance in map units that a record will move. If 0 all NA records will be changed.

Details

Often records are in coastal or other areas for which no environmental data is available. This function moves such records to the closest cells with data so that no information is lost during modelling.

Value

A matrix with new coordinate values.

Examples

1
2
3
4
5
6
7
rast <- raster::raster(matrix(c(rep(NA,100), rep(1,100), rep(NA,100)), ncol = 15))
pts <- cbind(runif(100, 0, 0.55), runif(100, 0, 1))
raster::plot(rast)
points(pts)
pts <- move(pts, rast)
raster::plot(rast)
points(pts)

cardosopmb/red documentation built on May 13, 2020, 2:04 p.m.