Function that simultaneously adds many trait value replacements, potentially across many trait_name's and dataset_id's, to the respective metadata.yml files. This function will be used to quickly re-align/re-assign trait values across all studies.

metadata_add_substitutions_table(
  dataframe_of_substitutions,
  dataset_id,
  trait_name,
  find,
  replace
)

Arguments

dataframe_of_substitutions

Dataframe with columns indicating dataset_id, trait_name, original trait values (find), and database aligned trait value (replace)

dataset_id

Name of column containing study dataset_id(s) in database

trait_name

Name of column containing trait name(s) for which a trait value replacement needs to be made

find

Name of column containing trait values submitted by the contributor for a data observation

replace

Name of column containing database aligned trait values

Value

Modified metadata files with trait value replacements

Examples

if (FALSE) {
read_csv("export/dispersal_syndrome_substitutions.csv") %>%
  select(-extra) %>%
  filter(dataset_id == "Angevin_2011") -> dataframe_of_substitutions
metadata_add_substitutions_table(dataframe_of_substitutions, dataset_id, trait_name, find, replace)
}