randomOcc: Place occurrence points at random within low-resolution grid...

Description Usage Arguments Value Examples

View source: R/FunctionOccurrence.R

Description

This function is used to randomise the location of a presence point where the species occurrence data is low resolution. For example, if your species occurrence data is at 1km resolution, but your environmental predictor variables are at 200m resolution, this enables you to randomise where within the 1km cell your species record is placed. The function can handle multiple resolutions within a single dataframe, as long as these are labelled with a precision column. Jittering for lat lon points is unlikely to be accurate to within 10m, consider using a projected coordinate system for high resolution data

Usage

1
2
randomOcc(presframe, coordsys = "m", precisionCol = "precision",
  lowestResm = 10000, covarResm = 300)

Arguments

presframe

Spatial points data frame of presence points. This should include columns titled 'easting' and 'northing', which should be x and y coordinates in metres (of the centre of the grid cell for gridded data), as well as a column giving the resolution (see prescisionCol below).

coordsys

The units of the coordinate system used, either "latlon" for decimal latitude and longitude or "m" for a projected coordinate system with meter units.

precisionCol

The column indicating the resolution of the presence point data. This should be given as a grid cell size in metres e.g. for a 1km grid this should be 1000.

lowestResm

The column indicating the lowest resolution limit for the presence point data in meters. If your presence record is in a higher resolution than this limit, then it will remain at its current state.

covarResm

The resolution of the environmental covariate data layers, in metres. Data will not be discarded if it is of higher resolution than the environmental covariate layers.

Value

A copy of the input dataframe presframe as a spatial points data frame, with new x and y values that place each point randomly within its grid cell.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Example using coordinates in British National Grid :
#load in the data
data(ng_data)

#prepare the data using the bngprep function in this package
speciesdf <- bngprep(speciesdf = ng_data, bngCol = 'OSGR', datafrom = 'NBNatlas', mindata = 5000, minyear = 2007, covarRes = 300)

#convert to a SpatialPointsDataFrame
sp::coordinates(speciesdf)<- ~ easting + northing

#run the random occurrences function
randomOcc(presframe = speciesdf, precisionCol = "precision", coordsys = "m")

Example using coordinates in latitude and longitude:
#load in the data
data(ng_data)
names(ng_data)[26] <- "Decimal longitude (WGS84)"

#prepare the data using the latlonprep function in this package
speciesdf <- latlonprep(speciesdf = ng_data, xCol = "Decimal latitude (WGS84)", yCol = "Decimal longitude (WGS84)", precisionCol = "Coordinate uncertainty in metres", yearCol = "Year", minyear = 2000, maxyear = 2007, GBonly = TRUE)

#convert to spatial points data frame
names(speciesdf)
yCol = "longitude"
xCol = "latitude"
sp::coordinates(speciesdf)<- c(yCol, xCol)
#run the random occurrences function
randomOcc(presframe = speciesdf, precisionCol = "precision", coordsys = "latlon", covarResm = 50)

jncc/sdms documentation built on Aug. 13, 2021, 4:21 a.m.