R/dataset_checks.R
dataset_check_duplicates_within_dataset.RdLists the taxa that have several values for a trait in a dataset, all of
them identical. This is usually a value recorded once for the species, such
as its growth form, repeated on every row of individual measurements, or a
single bulked measurement reported for each individual that contributed to
it. Neither is disallowed, so dataset_test() does not check for it, but a
value repeated this way counts as several observations when it is one, and
is usually better entered once, with the entity_type it describes.
dataset_check_duplicates_within_dataset(
database,
dataset_ids = NULL,
trait_types = "categorical"
)Compiled database object, e.g. austraits
dataset_id's to check. The default, NULL, checks every
dataset in the database.
Types of trait to check. The default checks categorical
traits only: numeric values repeat by coincidence, especially for traits
reported to few significant figures, but c("categorical", "numeric")
checks both.
A list of two tibbles:
summaryOne row per dataset and trait with at least one taxon
whose values are all identical. n_taxa_several is the number of taxa
with more than one value for the trait, and n_taxa_repeated the number
of those whose values are all identical, counting a taxon once for each
name, location and value type. entity_type lists the entity types of the
trait's values. Sorted by dataset, then with the traits repeated for the
largest share of taxa first.
taxaOne row per taxon, name, location and value type whose
values are all identical, with the value and how many records hold it
(n_records).
Values are compared within a taxon as the source names it, by
original_name, at a single location. Values for names the source gives
separately but the taxonomy merges into one taxon_name, as for synonyms in
a flora, are separate records of the source rather than repeats; and a
taxon scored once at each of several sites, as in a survey of fire
responses, has one value per population, as it should. Neither is counted.
Values of different value_types are not compared either, so a minimum and
a maximum that happen to agree are not a repeat.
What remains is the same value given more than once for one name at one
place: copied down to individuals, or repeated across method_contexts,
temporal_contexts or sources, any of which may be intended.
A trait repeated for nearly every taxon with several values, so that
n_taxa_repeated is close to n_taxa_several in summary, has most likely
been copied down a column, or mapped from two columns that agree. A few
repeated taxa among many that vary is what a trait that varies little looks
like.
if (FALSE) { # \dontrun{
dataset_check_duplicates_within_dataset(austraits, "Tsakalos_2020")
} # }