Apply many manual corrections to a reconciliation at once
Source:R/reconcile_override_batch.R
reconcile_override_batch.RdA convenience wrapper around reconcile_override() for curated
batches of manual decisions.
Arguments
- reconciliation
A reconciliation object returned by
reconcile_tree(),reconcile_data(), or a related matcher.- overrides
A data frame, or a length-1 character vector giving the path to a CSV file with the same columns:
name_x(required)The original name in source
x(your data).actionOne of
"accept"(default),"reject","replace". Seereconcile_override()for the semantics.name_yThe target name in source
y; required for"accept"and"replace".noteOptional free-text justification.
- quiet
Logical. Suppresses per-override success messages when
TRUE. DefaultFALSE.
Value
An updated reconciliation object with all overrides applied.
Details
Typical workflow: generate a CSV of corrections (by hand, or with
the help of reconcile_suggest()), check it into version control,
and apply it on every run so the corrections are reproducible and
reviewable.
See also
reconcile_override() for the single-override case;
reconcile_crosswalk() for building an override table from a
published taxonomy crosswalk.
Other reconciliation functions:
reconcile_apply(),
reconcile_augment(),
reconcile_crosswalk(),
reconcile_data(),
reconcile_diff(),
reconcile_export(),
reconcile_mapping(),
reconcile_merge(),
reconcile_multi(),
reconcile_override(),
reconcile_plot(),
reconcile_report(),
reconcile_review(),
reconcile_splits_lumps(),
reconcile_suggest(),
reconcile_summary(),
reconcile_to_trees(),
reconcile_tree(),
reconcile_trees()
Examples
data(avonet_subset)
data(tree_jetz)
result <- reconcile_tree(avonet_subset, tree_jetz,
x_species = "Species1", authority = NULL)
#> ℹ Reconciling 919 data names vs 657 tree tips
#> ℹ Matching 919 x 657 names through 2 stages...
#> ℹ Stage 1/2: Exact matching...
#> ℹ Stage 2/2: Normalised matching (0 matched so far)...
#> ✔ Matched 657/919 data names to tree tips
# Create a batch of overrides
batch <- data.frame(
name_x = reconcile_mapping(result)$name_x[
reconcile_mapping(result)$match_type == "unresolved" &
reconcile_mapping(result)$in_x][1:2],
name_y = tree_jetz$tip.label[1:2],
action = "accept",
note = "Batch demo",
stringsAsFactors = FALSE
)
batch <- batch[!is.na(batch$name_x), ]
if (nrow(batch) > 0) {
result2 <- reconcile_override_batch(result, batch)
}
#> ✔ Override applied: 'Acanthiza cinerea' -> 'Amytornis_barbatus' (accept)
#> ✔ Override applied: 'Calamanthus cautus' -> 'Amytornis_merrotsyi' (accept)
#> ✔ Applied 2 overrides.