fix.coastal.points: Shift points to the nearest non-NA cell of a base raster...

Description Usage Arguments Value Author(s) Examples

View source: R/fix.coastal.points.R

Description

The function moves points to the nearest non-NA cell of a base raster within a maximum distance.

Usage

1
2
fix.coastal.points(data, xy.cols, r, ncell, clip.by.poly = F, poly,
  occ.desaggregation = F)

Arguments

data

a matrix or data.frame containing the points coordinates

xy.cols

a numeric vector indicating the IDs of the x-y columns

r

a RasterLayer object to be used as base raster map

ncell

an integer indicating the maximum number of cells away from the points where they can be shifted. If the nearest non-NA cell fall farther than this distance from a give point, this will be dropped

clip.by.poly

a logical vector indicating if the base raster must be clipped along the boundaries of a polygon

poly

a SpatialPolygons object used to clip the base raster map

occ.desaggregation

a logical vector indicating if to apply the occ.desaggregation.RASTER function

Value

a matrix including the shifted points

Author(s)

Mirko Di Febbraro

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
library(raster)
raster(system.file("exdata/prediction_ground.gri", package="DeepTime"))->prediction_ground
data(lgm)

data_clupus<-subset(lgm, spec=="Canis_lupus")

coordinates(data_clupus)<-~x+y
proj4string(data_clupus)<-"+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"
data_clupus<-spTransform(data_clupus, proj4string(prediction_ground))
data_clupus<-as.data.frame(data_clupus)

data_mammuth_reduced<-fix.coastal.points(data_clupus, xy.cols = 4:5,
r = prediction_ground, ncell = 1, occ.desaggregation = F)

## End(Not run)

francesco-carotenuto/PaleoMacroEco documentation built on Dec. 23, 2019, 6:36 p.m.