latlonprep: Prepare data from NBN Atlas for use in species distribution...

Description Usage Arguments Value Examples

View source: R/FunctionLatLondataprep.R

Description

This function removes absence data (as the models generate their own pseudo-absences), subset the data based on year and allows modelling of GB and Northern Ireland using latitude and longitude coordinates. A presence record is assumed to be denoted as "present" by the column "Occurrence status" in NBN Atlas data.

Usage

1
2
3
4
5
latlonprep(speciesdf, xCol = "Latitude (WGS84)",
  yCol = "Longitude (WGS84)",
  precisionCol = "Coordinate uncertainty (m)", yearCol = "Year",
  minyear = 0, maxyear = 0, mindata = 500, covarRes = 300,
  GBonly = TRUE, presencecol = F)

Arguments

speciesdf

Data frame exported from the NBN atlas with data for a species.

xCol

The column name of the column in speciesdf giving the species record location as a decimal latitude.

yCol

The column name of the column in speciesdf giving the species record location as a decimal longitude.

precisionCol

The column name of the column in speciesdf denoting the precision of the species record locations. For NBNAtlas this is denoted as the "Coordinate uncertainty (m)". where denoted with km or m, this will be converted into meters. Where records are NA these will be kept by changing to precision =0

yearCol

The column name in speciesdf giving the year of the record.

minyear

Numeric, the earliest year from which data should be selected. Year inclusive, data older than this will be discarded.

maxyear

Numeric, the latest year from which data should be used. Year inclusive, data newer than this will be discarded.

mindata

The target minimum number of data points to return. If this is specified, the lowest resolution data will be discarded if there are enough higher resolution data points available to reach this target.

covarRes

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.

GBonly

logical, TRUE if you wish to remove Northern Ireland from the records, FALSE if you wish to retain all records.

presencecol

logical, TRUE if a column is present defining whether it is a presence or absence which has been recorded, Those not noted as 'present' will be removed. FALSE is the default and will assume all data present are presence records.

Value

A copy of speciesdf as a data frame with absence data removed, subset to your year range and area of interest.

Examples

1
2
3
4
data(ng_data)
names(ng_data)[26] <- "Decimal longitude (WGS84)"

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)

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