c14bazAAR
provides several functions to check and improve the
spatial attribution of the individual dates in a c14_date_list to a country.
c14bazAAR::standardize_country_name()
adds column country_thes with
standardized country names. Most source databases come with a column country
that contains a character name of the origin country for each date. Unfortunately the
different source databases don't rely on a unified naming convention and therefore use
various terms to represent the same country (for example: United Kingdom, Great Britain,
GB, etc.). This function aims to standardize the country naming scheme. To achieve this,
it compares the names to values in an external (countrycode::codelist
)
and an internal
country_thesaurus
reference list. The latter needs
manual curation to catch semantic and spelling errors in the source databases.
c14bazAAR::determine_country_by_coordinate()
adds the column country_coord
with standardized country attribution based on the coordinate information of the dates.
Due to the inconsistencies in the country column in many c14 source databases
it's often necessary to rely on the coordinate position (lat & lon)
for reliable country attribution information.
finalize_country_name()
picks the country name in a hierarchical order from the results
of c14bazAAR::determine_country_by_coordinate()
and
c14bazAAR::standardize_country_name()
functions, followed by the original input
of the database. The result is added to the input date list with the column
country_final.
finalize_country_name()
also calls the other functions
c14bazAAR::determine_country_by_coordinate()
and
c14bazAAR::standardize_country_name()
if the necessary columns are missing yet.
determine_country_by_coordinate(x, suppress_spatial_warnings = TRUE)# S3 method for default
determine_country_by_coordinate(x, suppress_spatial_warnings = TRUE)
# S3 method for c14_date_list
determine_country_by_coordinate(x, suppress_spatial_warnings = TRUE)
finalize_country_name(x, quiet = FALSE)
# S3 method for default
finalize_country_name(x, quiet = FALSE)
# S3 method for c14_date_list
finalize_country_name(x, quiet = FALSE)
standardize_country_name(
x,
country_thesaurus = get_country_thesaurus(),
codesets = c("country.name.de", "iso3c"),
quiet = FALSE,
...
)
# S3 method for default
standardize_country_name(
x,
country_thesaurus = get_country_thesaurus(),
codesets = c("country.name.de", "iso3c"),
quiet = FALSE,
...
)
# S3 method for c14_date_list
standardize_country_name(
x,
country_thesaurus = get_country_thesaurus(),
codesets = c("country.name.de", "iso3c"),
quiet = FALSE,
...
)
an object of class c14_date_list
suppress some spatial data messages and warnings
suppress suppress decision log output
data.frame with correct and variants of country names
which country codesets should be searched for in countrycode::codelist
beyond country.name.en? See ?countrycode::codelist
for more information
additional arguments are passed to stringdist::stringdist()
.
stringdist()
is used for fuzzy string matching of the country names in
countrycode::codelist
an object of class c14_date_list with the additional columns country_thes, country_coord and/or country_final
# NOT RUN {
library(magrittr)
example_c14_date_list %>%
determine_country_by_coordinate() %>%
standardize_country_name() %>%
finalize_country_name()
# }
Run the code above in your browser using DataLab