Skip to contents

Flags every record of a dataset whose coordinates lie on a regular grid, as when records were collected or published per grid cell. For each axis the absolute coordinates are binned into about 3000 classes, the autocorrelation of the bin counts is computed, and its outliers (values above Q75 + T1 x IQR in sliding windows) are located; regularly spaced outliers, at a common distance between reg_dist_min and reg_dist_max degrees found at least reg_out_thresh times, mark the axis as periodic. A dataset fails when both axes are periodic (axis = "both") or the chosen one is. Datasets with fewer than min_unique_ds_size distinct coordinates are not tested.

Usage

clean_dataset_rounded(
  x,
  T1 = 7,
  reg_out_thresh = 2,
  reg_dist_min = 0.1,
  reg_dist_max = 2,
  min_unique_ds_size = 4,
  axis = "both",
  ...
)

Arguments

x

A data frame of occurrence records.

T1, reg_out_thresh, reg_dist_min, reg_dist_max, min_unique_ds_size, axis

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.

Settings

settings = list(dataset_rounded = list(...)) with T1 (7), reg_out_thresh (2), reg_dist_min (0.1), reg_dist_max (2), min_unique_ds_size (4) and axis ("both").

CoordinateCleaner

Equivalent to cd_round(); identical flags. In CoordinateCleaner 3.0.1 an input with several datasets of which one is below min_unique_ds_size stops with an error; here that dataset is not tested. Records without a dataset key are not flagged.

Examples

set.seed(2)
x <- data.frame(datasetKey = rep(c("ok", "grid"), each = 400),
                decimalLongitude = c(runif(400, 0, 20), round(runif(400, 0, 20) * 2) / 2 + 0.01),
                decimalLatitude = c(runif(400, 0, 20), round(runif(400, 30, 50) * 2) / 2 + 0.01))
tapply(flag_occurrences(x, tests = "dataset_rounded")$flag_dataset_rounded, x$datasetKey, all)
table(clean_dataset_rounded(x)$datasetKey)