country_attribution: Functions to improve the country attribution in a...

Description Usage Arguments Value Examples

Description

c14bazAAR provides two functions to check and improve the spatial attribution of the individual dates in a c14_date_list to a country.

c14bazAAR::fix_database_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. The latter relies on manual curation to catch semantic and spelling errors in the source databases. See inspect_lookup_country to trace the lookup decisions.

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 country attribution information. Unfortunately not all source databases store coordinates.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
determine_country_by_coordinate(x, suppress_spatial_warnings = TRUE)

## Default S3 method:
determine_country_by_coordinate(x, suppress_spatial_warnings = TRUE)

## S3 method for class 'c14_date_list'
determine_country_by_coordinate(x, suppress_spatial_warnings = TRUE)

fix_database_country_name(
  x,
  thesaurus = c14bazAAR::country_thesaurus,
  codesets = c("country.name.de", "iso3c"),
  ...
)

## Default S3 method:
fix_database_country_name(
  x,
  thesaurus = c14bazAAR::country_thesaurus,
  codesets = c("country.name.de", "iso3c"),
  ...
)

## S3 method for class 'c14_date_list'
fix_database_country_name(
  x,
  thesaurus = c14bazAAR::country_thesaurus,
  codesets = c("country.name.de", "iso3c"),
  ...
)

Arguments

x

an object of class c14_date_list

suppress_spatial_warnings

suppress some spatial data messages and warnings

thesaurus

data.frame with "correct" country names and "wrong" variants

codesets

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

Value

an object of class c14_date_list with the additional columns country_thes, country_coord and/or country_final

Examples

1
2
3
4
5
6

ISAAKiel/c14bazAAR.mirror documentation built on April 29, 2021, 3:03 p.m.