quickclean: Automated data cleaning

Description Usage Arguments Value Author(s) See Also Examples

View source: R/quickclean.R

Description

Automated data cleaning. Performs a country mismatch check if the country field is specified, it performs a check to determine if the records are at the appropriate precision for the spatial resolution, it assigns point records to the nearest cell containing environmental data (using nearestcell) and removes records that are in the wrong environment. It flags duplicate records per species per grid cell.

Usage

1
2
quickclean(world,dat, ID = "ID", Species = "Species", x = "x", 
y = "y", countries = "", others = "", res, msk, ext)

Arguments

world

a shapefile of the world, where the column containing the country names must be "NAMES"; see data(wrld_simpl)

dat

A dataframe containing the required biogeo fields (see checkdatastr)

ID

The unique identifier field

Species

The field containing the species names

x

x-coordinate in decimal degrees

y

y-coordinate in decimal degrees

countries

A field containing country names

others

Names of other fields that should be retained in the dataframe.

res

Spatial resolution for the richness map specified in minutes

msk

A mask index of the same spatial resolution as res

ext

The extent for the map. This can be ext="p" to use the point data to calculate the extent. It could be an Exent object from the Raster package or a vector containing the following: minx, maxx, miny, maxy.

Value

Returns a dataframe containing the identifiers (ID), species names (Species), x-coordinate (x), y-coordinate (y), a unique cell index (indx), and duplicates (dups). All records contaning errors in the input dataframe are removed.

Author(s)

Mark Robertson

See Also

errorcheck, nearestcell, elevcheck, quickrich

Examples

1
2
dat2<-quickclean(world,dat,ID='ID',Species='Species',x='x',y='y',
countries = '',others='',res=60,msk=msk60,ext="")

biogeo documentation built on May 1, 2019, 8:05 p.m.