Skip to contents

This function processes a global country similarity distance matrix and extracts the subset of African countries, normalizes country names, and matches them to ISO3 codes. The resulting matrix for African countries is saved as a CSV file. Country similarity data comes from the Objective Lists Country Similarity Index.

Usage

process_country_similarity_data(PATHS)

Arguments

PATHS

A list containing the paths where raw and processed data are stored. Typically generated by the get_paths() function, and should include:

  • DATA_RAW: Path to the directory containing the raw similarity matrix data.

  • DATA_SIMILARITY_MATRIX: Path to the directory where the processed African similarity matrix will be saved.

Value

The function saves the processed similarity matrix for African countries in the specified directory.

Details

This function performs the following steps:

  1. Loads a global similarity distance matrix from a CSV file.

  2. Normalizes country names to title case and replaces non-standard names like "Ivory Coast" with "Cote d'Ivoire" to match ISO3 country standards.

  3. Subsets the matrix to only include African countries, based on ISO3 codes provided by MOSAIC::iso_codes_africa.

  4. Outputs a CSV file containing the similarity matrix for African countries, with row and column names in ISO3 format.

Examples

if (FALSE) { # \dontrun{
# Example usage to process the country similarity matrix for African countries
PATHS <- get_paths()
process_country_similarity_data(PATHS)
} # }