Skip to contents

Flags every record of a dataset whose coordinates look converted from degrees and minutes as if they were decimal degrees, which leaves no decimal part above .59. The decimal parts of each dataset's distinct coordinates are placed on a mat_size x mat_size grid; a binomial test compares the share of filled cells with both decimals below .6 with its expected share, and the dataset fails when the excess is significant (p < pvalue) and larger than diff times the expected share. Datasets spanning less than min_span degrees in longitude or latitude are not tested.

Usage

clean_dataset_ddmm(
  x,
  pvalue = 0.025,
  diff = 1,
  mat_size = 1000,
  min_span = 2,
  ...
)

Arguments

x

A data frame of occurrence records.

pvalue, diff, mat_size, min_span

Options of the test, as in Settings; the defaults are in the usage line.

...

Further arguments to flag_occurrences(): columns, reference, gazetteers, land_scale.

Value

clean_<test>(): the rows of x the test does not flag, with the columns of x unchanged. See keep_unflagged(), Cleaning functions.

Fields

lon, lat, dataset (datasetKey by default).

Settings

settings = list(dataset_ddmm = list(...)) with pvalue (0.025), diff (1), mat_size (1000) and min_span (2).

CoordinateCleaner

Equivalent to cd_ddmm(); identical flags. Records without a dataset key are not flagged here; cd_ddmm() flags them.

Examples

set.seed(2)
ddmm <- function(n) floor(runif(n, 0, 20)) + sample(0:59, n, TRUE) / 100
x <- data.frame(datasetKey = rep(c("ok", "ddmm"), each = 300),
                decimalLongitude = c(runif(300, 0, 20), ddmm(300)),
                decimalLatitude = c(runif(300, 0, 20), ddmm(300)))
tapply(flag_occurrences(x, tests = "dataset_ddmm")$flag_dataset_ddmm, x$datasetKey, all)
table(clean_dataset_ddmm(x)$datasetKey)