Learn R Programming

biogeo (version 1.0)

errorcheck: Identifies errors in a dataset of point records

Description

It searches for mismatches between country names in the dataset and those extracted using the point records. Records for which there are no environmental data (based on the object rst) are indicated with a value of one in the field called wrongEnv. Low precision records are indicated by a value of one in the field lowprec. Environmental outliers are indicated by a value of one in a field beginning with the name of the environmental variable and ending either in "_e" for records assessed using boxplot statistics (e.g. bio1_e) or ending in "_j" for records assessed using the reverse jackknife procedure. The recorded elevation values for records (specified with a field name in elevc) are compared to digital elevation model values (which are returned in the field demElevation) and indicated as a mismatch if they exceed the value specified in the parameter called diff (the difference in metres).

Usage

errorcheck(world, dem, dat, countries="", countryfield="NAME", vars=c("bio1", "bio12", "bio5", "bio6"), res=10,elevc="",diff=50)

Arguments

world
A shapefile of the world, with the column containing the country names. See data(wrld_simpl)
dem
a digital elevation model raster
dat
A dataframe containing the required fields, including: ID, x, y, Species, x_original, y_original, Correction, Modified, Reason and Exclude. Required fields that are missing can be added using addmainfields.
countries
The name of the field in dat with country names.
countryfield
The name of the field in the shape file containing the country names. In wrld_simpl this field is "NAME".
vars
The names of the environmental variables to be used.
res
The spatial resolution of the grid to be created for identifying duplicate records. This value is given in minutes.
elevc
A field containing elevation or depth values for points.
diff
The difference between the elevation recorded and the elevation extracted from the DEM. Absolute differences that are greater than this value will be indicated as elevation mismatches.

Value

An error is returned if any of the fields are missing.

Details

The field called "error" will contain a value of one if there are any values of one in CountryMismatch, CountryMismatch, wrongEnv or any of the outlier fields. The field called "spperr" will contain ones for all records of a species for which there are one or more errors.

See Also

addmainfields, fieldsmissing, renamefields, env2stack, precisioncheck, quickclean, quickrich

Examples

Run this code
## Not run: 
# dem<-raster(dem,xmn=-180, xmx=180, ymn=-60, ymx=90)
# d8 <- errorcheck(world, dem, dat=edat, countries="Country", countryfield="NAME", 
# vars=c("bio1", "bio12", "bio5", "bio6"), res=10,elevc="elev",diff=50)
# ## End(Not run)

Run the code above in your browser using DataLab