Compares trait values across datasets in a compiled database and lists matches that may be the same data entered twice, such as a dataset that reuses values from an earlier study or a flora. This is a curation aid, not a test: many matches are coincidences, and the output is for deciding which are not. Only pairs of different datasets are compared.

dataset_check_duplicate_values(
  database,
  dataset_ids = NULL,
  max_distance_km = 10,
  min_sig_figs = 2,
  min_matches = 3,
  min_categorical_taxa = 10
)

Arguments

database

Compiled database object, e.g. austraits

dataset_ids

dataset_id's to check. Pairs involving any of them are reported, oriented so the dataset being checked is dataset_id_1. The default, NULL, checks every pair of datasets in the database.

max_distance_km

Records that both have coordinates only match if they are within this distance of each other. The default, 10 km, allows for coordinates rounded to 0.1 degrees.

min_sig_figs

Numeric values with fewer significant figures than this must be exactly equal to match

min_matches

Minimum number of taxon x trait combinations with a matching numeric value for a pair of datasets to be reported

min_categorical_taxa

Minimum number of taxa with matching categorical values for a pair of datasets to be reported

Value

A list of four tibbles:

numeric_pairs

One row per pair of datasets with numeric matches, sorted by prop_matched_combos. n_shared_combos is the number of taxon x trait combinations with numeric values in both datasets, and n_matched_combos how many of those have a matching value. prop_records_1 and prop_records_2 are the proportions of each dataset's records in those shared combinations that match a record in the other. n_identical counts matches with exactly equal values, n_georef_close matches where both records have coordinates, and n_obs_pairs_multi_trait pairs of observations that match on two or more traits. median_p_chance summarises p_chance (see numeric_records).

numeric_records

The matching records for the pairs in numeric_pairs, two rows per match sharing a match_id, with the dataset's location and context columns. match_precision is the number of significant figures the values were compared at (NA for bins), p_chance is the proportion of the trait's values across the whole database that share the matched value at that precision – the chance a value picked at random would match – and n_traits_observation_pair is the number of traits on which the two records' observations match.

categorical_pairs

As numeric_pairs, for georeferenced categorical values. prop_records_1 and prop_records_2 are the proportions of each dataset's georeferenced categorical records that match, and n_same_coordinates counts matches less than 10 m apart.

categorical_records

The matching records for the pairs in categorical_pairs, laid out as numeric_records.

Details

Numeric traits. Two records match when they are for the same taxon_name and trait_name and their values agree once both are rounded to the precision of the less precise one – so 1.23 matches 1.2, but 1.26 does not. Precision is the number of significant figures in the value as stored, capped at 6. When either value has fewer than min_sig_figs significant figures, the values must be exactly equal, since 2 would otherwise match anything from 1.5 to 2.49. Bins (value_type bin, e.g. 1--5) must be identical. Records that both have coordinates must also be within max_distance_km of each other; records without coordinates are matched on value alone, as most species-level data (floras, compilations) have none.

Categorical traits. A set value per species is the norm, so identical values are only compared when both records have coordinates within max_distance_km, and a pair of datasets is only reported when such matches span at least min_categorical_taxa taxa. Values holding the same terms in a different order (shrub tree, tree shrub) count as identical, as they always did when every database sorted its terms, so the result does not depend on the database's trait_value_term_order. Traits of type monthly_presence and text are compared in the same way, but on their values as written.

Telling duplicates from coincidences. Genuinely duplicated data usually shows up as a high prop_matched_combos – nearly every taxon x trait the two datasets share has a matching value – across several taxa, often with n_obs_pairs_multi_trait > 0 (the same pair of observations matching on several traits) and a low p_chance. Beware traits with a narrow range that are commonly reported to two significant figures, such as leaf nitrogen concentration: p_chance is high for these, and a large pair of datasets will share some values by chance.