main 284d6a2f7e49 cached
166 files
15.3 MB
1.2M tokens
1 requests
Download .txt
Showing preview only (5,501K chars total). Download the full file or copy to clipboard to get everything.
Repository: vincentarelbundock/countrycode
Branch: main
Commit: 284d6a2f7e49
Files: 166
Total size: 15.3 MB

Directory structure:
gitextract_dg_woieq/

├── .Rbuildignore
├── .github/
│   ├── .gitignore
│   └── workflows/
│       ├── altdoc.yaml
│       ├── lint.yaml
│       ├── r-check.yaml
│       └── revdep.yaml
├── .gitignore
├── .here
├── .scrutin/
│   └── config.toml
├── DESCRIPTION
├── LICENSE
├── Makefile
├── NAMESPACE
├── NEWS.md
├── R/
│   ├── cldr_examples.R
│   ├── codelist.R
│   ├── codelist_panel.R
│   ├── countrycode-package.R
│   ├── countrycode.R
│   ├── countryname.R
│   ├── countryname_dict.R
│   ├── get_dictionary.R
│   └── guess_field.R
├── README.Rmd
├── README.md
├── _pkgdown.yml
├── altdoc/
│   ├── .nojekyll
│   ├── docsify.html
│   ├── docsify.md
│   ├── preamble_man_qmd.yml
│   ├── preamble_vignettes_qmd.yml
│   └── preamble_vignettes_rmd.yml
├── appveyor.yml
├── countrycode.Rproj
├── cran-comments.md
├── data/
│   ├── cldr_examples.rda
│   ├── codelist.rda
│   ├── codelist_panel.rda
│   ├── countryname_dict.rda
│   ├── custom_dictionaries/
│   │   ├── data_ch_cantons.csv
│   │   ├── data_ch_cantons.rds
│   │   ├── data_exiobase3.csv
│   │   ├── data_exiobase3.rds
│   │   ├── data_global_burden_of_disease.csv
│   │   ├── data_global_burden_of_disease.rds
│   │   ├── data_gtap10.csv
│   │   ├── data_gtap10.rds
│   │   ├── data_gtap11.csv
│   │   ├── data_gtap11.rds
│   │   ├── data_gtap6.csv
│   │   ├── data_gtap6.rds
│   │   ├── data_gtap7.csv
│   │   ├── data_gtap7.rds
│   │   ├── data_gtap8.csv
│   │   ├── data_gtap8.rds
│   │   ├── data_gtap9.csv
│   │   ├── data_gtap9.rds
│   │   ├── data_us_states.csv
│   │   ├── data_us_states.rds
│   │   ├── get_ch_cantons.R
│   │   ├── get_exiobase3.R
│   │   ├── get_global_burden_of_disease.R
│   │   ├── get_gtap.R
│   │   └── get_us_states.R
│   └── extra/
│       └── countryhood.csv
├── dictionary/
│   ├── Dockerfile
│   ├── build.R
│   ├── codelist_panel_without_cldr.csv
│   ├── codelist_without_cldr.csv
│   ├── data_aviation.csv
│   ├── data_backup.rds
│   ├── data_cctld.csv
│   ├── data_cldr.csv
│   ├── data_cow.csv
│   ├── data_dhs.csv
│   ├── data_ecb.csv
│   ├── data_eurostat.csv
│   ├── data_fao.csv
│   ├── data_fips.csv
│   ├── data_fips.xls
│   ├── data_genc.csv
│   ├── data_gw.csv
│   ├── data_icao.csv
│   ├── data_imf.csv
│   ├── data_ioc.csv
│   ├── data_iso.csv
│   ├── data_iso4217.csv
│   ├── data_polity4.csv
│   ├── data_polity5.csv
│   ├── data_raw/
│   │   ├── data_small_countries.csv
│   │   ├── data_telephone.csv
│   │   └── data_vdem_v15_march2025.rds
│   ├── data_regex.csv
│   ├── data_regions.csv
│   ├── data_small_countries.csv
│   ├── data_telephone.csv
│   ├── data_un.csv
│   ├── data_un_names.csv
│   ├── data_unhcr.csv
│   ├── data_unicode_symbol.csv
│   ├── data_unpd.csv
│   ├── data_vdem.csv
│   ├── data_world_bank.csv
│   ├── data_world_bank_api.csv
│   ├── data_world_bank_region.csv
│   ├── data_wvs.csv
│   ├── get_cctld.R
│   ├── get_cldr.R
│   ├── get_countryname_dict.R
│   ├── get_cow.R
│   ├── get_dhs.R
│   ├── get_ecb.R
│   ├── get_eurostat.R
│   ├── get_fao.R
│   ├── get_fips.R
│   ├── get_genc.R
│   ├── get_gw.R
│   ├── get_ioc.R
│   ├── get_iso.R
│   ├── get_iso4217.R
│   ├── get_polity4.R
│   ├── get_polity5.R
│   ├── get_small_countries.R
│   ├── get_telephone.R
│   ├── get_un.R
│   ├── get_un_names.R
│   ├── get_unhcr.R
│   ├── get_unicode_symbol.R
│   ├── get_vdem.R
│   ├── get_world_bank.R
│   ├── get_world_bank_api.R
│   ├── get_world_bank_region.R
│   ├── get_wvs.R
│   └── utilities.R
├── inst/
│   └── CITATION
├── joss/
│   ├── paper.bib
│   └── paper.md
├── man/
│   ├── cldr_examples.Rd
│   ├── codelist.Rd
│   ├── codelist_panel.Rd
│   ├── countrycode.Rd
│   ├── countryname.Rd
│   ├── countryname_dict.Rd
│   ├── get_dictionary.Rd
│   └── guess_field.Rd
├── tests/
│   ├── test-all.R
│   └── testthat/
│       ├── data-known-name-variations.R
│       ├── test-basic.R
│       ├── test-codelist.R
│       ├── test-corner-cases.R
│       ├── test-countryname.R
│       ├── test-custom-dictionary.R
│       ├── test-destination-only.R
│       ├── test-destination.R
│       ├── test-dictionary_attributes.R
│       ├── test-known-name-variations.R
│       ├── test-nomatch.R
│       ├── test-regex-external.R
│       ├── test-regex-internal.R
│       ├── test-regex-sentence.R
│       ├── test-regex-special.R
│       └── test-unicode-symbols.R
└── vignettes/
    ├── contributions.qmd
    ├── countrycode.qmd
    ├── countryname.qmd
    └── custom.qmd

================================================
FILE CONTENTS
================================================

================================================
FILE: .Rbuildignore
================================================
cran-comments.md
data/backup.rds
data/dictionary_static.csv
data/extra
data/custom_dictionaries
README.md
LICENSE*
joss
^dictionary
.lintr
revdep*
.travis.yml
^.*\.Rproj$
^\.Rproj\.user$
.here
^CRAN-RELEASE$
^appveyor\.yml$
^_pkgdown\.yml$
^docs$
^pkgdown$
^\.github$
README.Rmd
README.html
^altdoc$
^docs$
^docs/$
^vignettes/
Makefile
^_quarto$
.claude/
^\.scrutin$


================================================
FILE: .github/.gitignore
================================================
*.html


================================================
FILE: .github/workflows/altdoc.yaml
================================================
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
  push:
    branches: [main, master]
  pull_request:
    branches: [main, master]
  release:
    types: [published]
  workflow_dispatch:

name: altdoc

jobs:
  altdoc:
    runs-on: ubuntu-latest
    # Only restrict concurrency for non-PR jobs
    concurrency:
      group: altdoc-${{ github.event_name != 'pull_request' || github.run_id }}
    env:
      GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
    permissions:
      contents: write
    steps:
      - uses: actions/checkout@v4

      - uses: quarto-dev/quarto-actions/setup@v2

      - name: Get Script
        run: curl -OLs https://eddelbuettel.github.io/r-ci/run.sh && chmod 0755 run.sh

      - name: Bootstrap
        run: ./run.sh bootstrap

      - name: Dependencies
        run: ./run.sh install_all

      - name: Build site
        run: |
          # If parallel = TRUE in render_docs()
          # future::plan(future::multicore)
          install.packages(".", repos = NULL, type = "source")
          install.packages("pkgload")
          pkgload::load_all()
          altdoc::render_docs(parallel = FALSE, freeze = FALSE)
        shell: Rscript {0}

      - name: Deploy to GitHub pages 🚀
        if: github.event_name != 'pull_request'
        uses: JamesIves/github-pages-deploy-action@v4
        with:
          clean: false
          branch: gh-pages
          folder: docs


================================================
FILE: .github/workflows/lint.yaml
================================================
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
  push:
    branches: [main, master]
  pull_request:
    branches: [main, master]

name: lint

jobs:
  lint:
    runs-on: ubuntu-latest
    env:
      GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
    steps:
      - uses: actions/checkout@v3

      - uses: r-lib/actions/setup-r@v2
        with:
          use-public-rspm: true

      - uses: r-lib/actions/setup-r-dependencies@v2
        with:
          extra-packages: any::lintr, local::.
          needs: lint

      - name: Lint
        run: lintr::lint_package()
        shell: Rscript {0}
        env:
          LINTR_ERROR_ON_LINT: false


================================================
FILE: .github/workflows/r-check.yaml
================================================
on:
  push:
    branches: [main, master]
  pull_request:

name: scrutin

permissions: read-all

jobs:
  check:
    runs-on: ${{ matrix.config.os }}
    name: ${{ matrix.config.os }} (${{ matrix.config.r }})
    strategy:
      fail-fast: false
      matrix:
        config:
          - {os: macos-latest,   r: 'release'}
          - {os: windows-latest, r: 'release'}
          - {os: ubuntu-latest,  r: 'release'}
    steps:
      - uses: actions/checkout@v4

      - uses: vincentarelbundock/scrutin/.github/actions/install_r@main
        with:
          r-version: ${{ matrix.config.r }}
          packages: any::rcmdcheck

      - uses: vincentarelbundock/scrutin/.github/actions/check_r@main

      - uses: vincentarelbundock/scrutin/.github/actions/install_scrutin@main

      - run: scrutin -r github --set run.tool=testthat


================================================
FILE: .github/workflows/revdep.yaml
================================================
# This workflow creates many jobs, run only when a branch is created
on:
  push:
    branches:
      - "revdep*" # never run automatically on main branch

name: revdep

jobs:
  matrix:
    runs-on: ubuntu-22.04
    outputs:
      matrix: ${{ steps.set-matrix.outputs.matrix }}

    name: Collect revdeps

    env:
      R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
      RSPM: https://packagemanager.rstudio.com/cran/__linux__/bionic/latest
      GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
      # prevent rgl issues because no X11 display is available
      RGL_USE_NULL: true
      # Begin custom: env vars
      # End custom: env vars

    steps:
      - name: Check rate limits
        run: |
          curl -s --header "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/rate_limit
        shell: bash

      - uses: actions/checkout@v3

      # FIXME: Avoid reissuing succesful jobs
      # https://docs.github.com/en/free-pro-team@latest/rest/reference/actions#list-jobs-for-a-workflow-run
      # https://docs.github.com/en/free-pro-team@latest/rest/reference/actions#workflow-runs
      - id: set-matrix
        run: |
          package <- read.dcf("DESCRIPTION")[, "Package"][[1]]
          deps <- tools:::package_dependencies(package, reverse = TRUE, which = c("Depends", "Imports", "LinkingTo", "Suggests"))[[1]]
          json <- paste0(
            '{"package":[',
            paste0('"', deps, '"', collapse = ","),
            ']}'
          )
          writeLines(json)
          writeLines(paste0("matrix=", json), Sys.getenv("GITHUB_OUTPUT"))
        shell: Rscript {0}

  check-matrix:
    runs-on: ubuntu-22.04
    needs: matrix
    steps:
      - name: Install json2yaml
        run: |
          sudo npm install -g json2yaml

      - name: Check matrix definition
        run: |
          matrix='${{ needs.matrix.outputs.matrix }}'
          echo $matrix
          echo $matrix | jq .
          echo $matrix | json2yaml

  R-CMD-check:
    needs: matrix

    runs-on: ubuntu-22.04

    name: ${{ matrix.package }}

    # Begin custom: services
    # End custom: services

    strategy:
      fail-fast: false
      matrix: ${{fromJson(needs.matrix.outputs.matrix)}}

    env:
      R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
      RSPM: https://packagemanager.rstudio.com/cran/__linux__/bionic/latest
      GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
      # prevent rgl issues because no X11 display is available
      RGL_USE_NULL: true
      # Begin custom: env vars
      # End custom: env vars

    steps:
      - name: Check rate limits
        run: |
          curl -s --header "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/rate_limit
        shell: bash

      - uses: actions/checkout@v3

      # Begin custom: before install
      # End custom: before install

      - name: Use RSPM
        run: |
          mkdir -p /home/runner/work/_temp/Library
          echo 'local({release <- system2("lsb_release", "-sc", stdout = TRUE); options(repos=c(CRAN = paste0("https://packagemanager.rstudio.com/all/__linux__/", release, "/latest")), HTTPUserAgent = sprintf("R/%s R (%s)", getRversion(), paste(getRversion(), R.version$platform, R.version$arch, R.version$os)))}); .libPaths("/home/runner/work/_temp/Library")' | sudo tee /etc/R/Rprofile.site

      - name: Install remotes
        run: |
          if (!requireNamespace("curl", quietly = TRUE)) install.packages("curl")
          if (!requireNamespace("remotes", quietly = TRUE)) install.packages("remotes")
        shell: Rscript {0}

      - uses: r-lib/actions/setup-pandoc@v2

      - name: Install system dependencies
        if: runner.os == 'Linux'
        run: |
          sudo apt-get update -y
          Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "22.04")); package <- "${{ matrix.package }}"; deps <- tools::package_dependencies(package, which = "Suggests")[[1]]; lapply(c(package, deps), function(x) { writeLines(remotes::system_requirements("ubuntu", "22.04", package = x)) })' | sort | uniq > .github/deps.sh
          cat .github/deps.sh
          sudo sh < .github/deps.sh

      - name: Install package
        run: |
          package <- "${{ matrix.package }}"
          install.packages(package, dependencies = TRUE)
          remotes::install_cran("rcmdcheck")
        shell: Rscript {0}

      - name: Session info old
        run: |
          options(width = 100)
          if (!requireNamespace("sessioninfo", quietly = TRUE)) install.packages("sessioninfo")
          pkgs <- installed.packages()[, "Package"]
          sessioninfo::session_info(pkgs, include_base = TRUE)
        shell: Rscript {0}

      # Begin custom: after install
      # End custom: after install

      - name: Check old
        env:
          _R_CHECK_CRAN_INCOMING_: false
          _R_CHECK_SYSTEM_CLOCK_: false
          _R_CHECK_FUTURE_FILE_TIMESTAMPS_: false
        # Avoid downloading binary package from RSPM
        run: |
          package <- "${{ matrix.package }}"
          options(HTTPUserAgent = "gha")
          path <- download.packages(package, destdir = ".github")[, 2]
          print(path)

          dir <- file.path("revdep", package)
          dir.create(dir, showWarnings = FALSE, recursive = TRUE)
          check <- rcmdcheck::rcmdcheck(path, args = c("--no-manual", "--as-cran"), error_on = "never", check_dir = file.path(dir, "check"))
          file.rename(file.path(dir, "check"), file.path(dir, "old"))
          saveRDS(check, file.path(dir, "old.rds"))
        shell: Rscript {0}

      - name: Install local package
        run: |
          remotes::install_local(".", force = TRUE)
        shell: Rscript {0}

      - name: Session info new
        run: |
          options(width = 100)
          pkgs <- installed.packages()[, "Package"]
          sessioninfo::session_info(pkgs, include_base = TRUE)
        shell: Rscript {0}

      - name: Check new
        env:
          _R_CHECK_CRAN_INCOMING_: false
          _R_CHECK_SYSTEM_CLOCK_: false
          _R_CHECK_FUTURE_FILE_TIMESTAMPS_: false
        run: |
          package <- "${{ matrix.package }}"
          path <- dir(".github", pattern = paste0("^", package), full.names = TRUE)[[1]]
          print(path)

          dir <- file.path("revdep", package)
          check <- rcmdcheck::rcmdcheck(path, args = c("--no-manual", "--as-cran"), error_on = "never", check_dir = file.path(dir, "check"))
          file.rename(file.path(dir, "check"), file.path(dir, "new"))
          saveRDS(check, file.path(dir, "new.rds"))
        shell: Rscript {0}

      - name: Compare
        run: |
          package <- "${{ matrix.package }}"
          dir <- file.path("revdep", package)
          old <- readRDS(file.path(dir, "old.rds"))
          new <- readRDS(file.path(dir, "new.rds"))
          compare <- rcmdcheck::compare_checks(old, new)
          compare
          cmp <- compare$cmp
          if (!identical(cmp[cmp$which == "old", "output"], cmp[cmp$which == "new", "output"])) {
            if (!requireNamespace("waldo", quietly = TRUE)) install.packages("waldo")
            print(waldo::compare(old, new))

            stop("Check output differs.")
          }
        shell: Rscript {0}

      - name: Upload check results
        if: failure()
        uses: actions/upload-artifact@main
        with:
          name: ${{ matrix.package }}-results
          path: revdep/${{ matrix.package }}

      - name: Check rate limits
        if: always()
        run: |
          curl -s --header "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/rate_limit
        shell: bash


================================================
FILE: .gitignore
================================================
.Rproj.user
.Rhistory
.RData
.Ruserdata
*.DS_Store
README.html
altdoc/freeze.rds
_quarto/
!_quarto/_freeze/
docs/

# scrutin history + caches (keep runner scripts tracked)
.scrutin/state.db*


================================================
FILE: .here
================================================


================================================
FILE: .scrutin/config.toml
================================================
# scrutin configuration
#
# scrutin is configured via .scrutin/config.toml in the project root. Fallback:
# ~/.config/scrutin/config.toml. There are no SCRUTIN_* environment
# variables: this file is the only persistent source of truth.
#
# Any field below can be overridden at invocation time with
# --set key.path=value (repeatable). The RHS is parsed as a TOML
# expression, falling back to a bare string for unquoted values. So
# --set run.workers=8, --set run.shuffle=true, --set run.tool=pytest
# and --set 'pytest.extra_args=["--tb=short"]' all Just Work.
#
# Precedence: built-in defaults < this file < --set overrides < surviving
# CLI flags. All fields are optional; every line below is commented out
# so the file is a no-op as-shipped.


# ---------------------------------------------------------------------------
# [[suite]]: explicit test-suite declarations
# ---------------------------------------------------------------------------
# When at least one [[suite]] entry is present, auto-detection is skipped
# entirely: you control exactly which tools run and where their
# files live. When absent (the default), scrutin auto-detects from
# marker files (DESCRIPTION, pyproject.toml, jarl.toml, ...) at the
# *project root* (this directory).
# Detected at `scrutin init` time: testthat
#
# Terminology:
#   - project root: where this .scrutin/config.toml lives. Anchors
#     shared state (.scrutin/state.db, runner scripts, hooks).
#   - suite root:   the directory each suite's tool runs from. Drives
#     the subprocess CWD and the SCRUTIN_PKG_DIR env var, so
#     pkgload::load_all() / pytest find the right DESCRIPTION /
#     pyproject.toml / .venv / ruff.toml / jarl.toml.
#
# Supported `tool` values: "testthat", "tinytest", "pointblank",
# "validate", "jarl", "pytest", "ruff", "great_expectations".
#
# Fields per [[suite]]:
#   tool   (required)  tool name
#   root   (optional)  suite root, relative to project root (default ".")
#                      Absolute paths allowed.
#   run    (optional)  glob patterns for files the tool operates on
#                      (tests to execute, files to lint). Always globs,
#                      anchored under `root`. Default: plugin-provided.
#   watch  (optional)  glob patterns for files watched to trigger
#                      reruns. Default: plugin-provided (or `run` for
#                      linters, which re-check what they operate on).
#   runner (optional)  path to a custom runner script, relative to
#                      the project root.
#
# Single-package project (default shape):
#
# [[suite]]
# tool = "testthat"
# # root / run / watch omitted → plugin defaults under project root
#
# Monorepo: two sibling packages under one scrutin invocation:
#
# [[suite]]
# tool = "testthat"
# root = "r"
#
# [[suite]]
# tool = "pytest"
# root = "python"
#
# Custom globs:
#
# [[suite]]
# tool  = "pytest"
# root  = "python"
# run   = ["tests/**/test_*.py"]
# watch = ["marginaleffects/**/*.py"]


# ---------------------------------------------------------------------------
# [run]: execution parameters
# ---------------------------------------------------------------------------
[run]
# tool = "auto"
#   Restrict auto-detection to a single tool. "auto" (default)
#   enables every tool whose marker files are present. Ignored
#   when explicit [[suite]] entries are configured.

# workers = 4
#   Number of concurrent test-file slots per suite. Default:
#   min(physical_cores, 8), minimum 2. In fork mode this is the
#   semaphore width (how many children run in parallel); there is
#   still exactly one parent process per suite.

# fork_workers = false
#   Worker isolation strategy. When false (the default), workers are
#   killed and respawned after every file: safe but pays startup cost
#   per file. When true (Linux/macOS only), each suite has one
#   long-lived parent that fork()s a copy-on-write child per test
#   file: fast startup + full process isolation.
#
#   Dangerous: forking a process that is itself multithreaded or that
#   spawns its own forked workers (R's parallel::mclapply, Python's
#   multiprocessing with the fork start method, BLAS/OpenMP threads,
#   etc.) can deadlock or crash the child. Only turn this on if you
#   know no code under test forks on its own. Auto-disabled on Windows
#   where fork() is unavailable.

# max_fail = 0
#   Stop after this many failing *files* (failed + errored). 0 (default)
#   means unlimited. File-level, not expectation-level: one crashing
#   file counts as one bad file regardless of how many assertions it
#   took down with it.

# color = true
#   ANSI color in plain-mode output. TUI and web always render colors
#   regardless of this setting.

# shuffle = false
#   Randomize test-file execution order to surface inter-file state
#   leaks. Does not reorder expectations within a file.

# seed = 0
#   Shuffle seed. Omit to draw a fresh seed from system time; the
#   drawn seed is always printed so the run is reproducible by
#   re-running with --set run.seed=<printed value>.

# timeout_file_ms = 0
#   Per-file timeout in milliseconds. A worker that doesn't return
#   results within this budget is killed and the file marked errored.
#   0 (default) disables the per-file timeout.

# timeout_run_ms = 0
#   Whole-run timeout in milliseconds across all suites. When
#   exceeded, every in-flight worker is cancelled. 0 (default)
#   disables this gate.

# reruns = 0
#   Re-execute failing files up to this many extra times before
#   reporting. A file that passes on attempt > 1 is marked flaky in
#   the history DB, in JUnit output, and in the plain-mode summary.

# reruns_delay = 0
#   Milliseconds to wait between rerun attempts. Useful for flakes
#   caused by external rate limits or eventual consistency in fixtures.


# ---------------------------------------------------------------------------
# [preflight]: startup checks that fail fast with actionable errors
# ---------------------------------------------------------------------------
# Each check runs once at scrutin startup, before any test worker
# spawns. Failures surface as a single clean error instead of per-file
# noise mid-run. Disable individual checks if they are wrong for your
# project, or set [preflight] enabled = false to skip them all.
#
# [preflight]
# enabled        = true   # master switch
# suite_roots    = true   # each [[suite]] root resolves to an existing dir
# run_globs      = true   # each suite's `run` matches at least one file
# command_tools  = true   # jarl / ruff are on PATH
# python_imports = true   # `import <project>` works in the resolved venv
# r_pkgload      = true   # R `pkgload` package is installed


# ---------------------------------------------------------------------------
# [watch]: file-watcher settings (TUI and web only)
# ---------------------------------------------------------------------------
[watch]
# enabled = true
#   Whether watch mode is on by default in the TUI and web. Override
#   with --set watch.enabled=false. Plain / GitHub / JUnit reporters
#   are always one-shot regardless.

# debounce_ms = 50
#   Coalesce file-change events within this window before triggering
#   a re-run. Raise if your editor writes many files in bursts.

# ignore = [".git", "*.Rhistory"]
#   Glob patterns excluded from the watcher. Matches paths relative
#   to the project root. The built-in ignore list also covers target/,
#   node_modules/, __pycache__/, etc.


# ---------------------------------------------------------------------------
# [filter]: test-file selection
# ---------------------------------------------------------------------------
[filter]
# include = []
#   Glob patterns: only run test files matching at least one pattern.
#   Empty (default) means no include filter.

# exclude = []
#   Glob patterns: skip test files matching any pattern. Applied
#   after include.

# group = "fast"
#   Activate a named filter group at startup (from [filter.groups.*]).
#   Equivalent to `-s filter.group=fast` on the CLI. When set, the
#   group's include/exclude/tools *replace* the top-level filter.
#   The TUI (f/F) and web dropdown cycle this at runtime.

# Named filter groups. Activate one with `-s filter.group=NAME` or
# by setting `group = "NAME"` above. The selected group's
# include/exclude/tools replace the top-level [filter] entries.
#
# [filter.groups.fast]
# tools   = ["pytest"]          # restrict to these tools (empty = all)
# include = ["**/test_unit_*.py"]
# exclude = ["**/test_slow_*.py"]


# ---------------------------------------------------------------------------
# [env]: environment variables injected into every subprocess
# ---------------------------------------------------------------------------
# Applied to worker subprocesses and command-mode plugins. Keys are
# validated case-insensitively (Path and PATH cannot coexist: they
# silently collapse on Windows). Empty values are legal (set the var
# to empty). No interpolation, no unset semantics. [env] always wins
# over inherited parent environment on conflict.
#
# [env]
# RUST_LOG     = "debug"
# DATABASE_URL = "postgres://localhost/test"


# ---------------------------------------------------------------------------
# [metadata]: run-provenance capture
# ---------------------------------------------------------------------------
# Controls what goes into the history DB and JUnit <properties>.
# Provenance (git SHA, branch, hostname, CI provider) is captured
# automatically when `enabled = true`.
#
# [metadata]
# enabled = true            # set false for privacy / air-gapped builds


# ---------------------------------------------------------------------------
# [extras]: user-supplied key/value labels attached to every run
# ---------------------------------------------------------------------------
# Goes into the `extras` table of the history DB and the JUnit
# <properties> block. Values can be any TOML scalar (string, int,
# float, bool) and are coerced to strings at the storage/reporter
# boundary, so --set extras.build=4521 Just Works without quoting.
#
# [extras]
# build  = 4521
# branch = "feature/auth"


# ---------------------------------------------------------------------------
# [agent]: send-to-LLM-agent handoff (`a` key in TUI Detail/Failure level
#                                     and the "ask agent" button in -r web)
# ---------------------------------------------------------------------------
# When you press `a` on a failing test, scrutin assembles a markdown
# diagnosis prompt (outcome + error + windowed test source + windowed
# dep-mapped production source) and spawns the configured CLI agent in
# a fresh terminal window pointed at the project root.
#
# All three fields are optional; with no [agent] block scrutin uses
# claude + auto-detected terminal + 20 lines of context.
#
# [agent]
# cli           = "claude"   # or "codex", "aider", "gemini", ...
# context_lines = 20         # lines of source on each side of the failing line
#
# Terminal launch: when `terminal` is unset, scrutin picks one in this
# order: $TMUX set → tmux new-window; $TERM_PROGRAM matches a known
# terminal (ghostty / iTerm.app / WezTerm / Apple_Terminal / kitty /
# alacritty) → that terminal; macOS → Terminal.app; Linux → $TERMINAL,
# x-terminal-emulator, then common emulators on $PATH.
#
# Override with a template containing `{script}` (path to wrapper
# script) and / or `{cwd}` (project root):
#
# terminal = "ghostty -e {script}"
# terminal = "tmux new-window -c {cwd} {script}"
# terminal = "alacritty --working-directory {cwd} -e {script}"


# ---------------------------------------------------------------------------
# [hooks]: lifecycle hook scripts
# ---------------------------------------------------------------------------
# Process hooks run once per invocation from the Rust binary.
# Worker hooks are sourced by each subprocess on boot / shutdown.
#
# [hooks]
# startup  = "scripts/before_run.sh"   # runs before first worker spawns;
#                                      # must be executable; failure aborts
# teardown = "scripts/after_run.sh"    # runs after last result drains;
#                                      # failure logs a warning only
#
# Language-level worker hooks apply to every tool in that language
# unless overridden by a tool-level entry.
#
# [hooks.r]
# worker_startup  = "scripts/r_setup.R"
# worker_teardown = "scripts/r_teardown.R"
#
# [hooks.r.testthat]
# worker_startup  = "scripts/testthat_setup.R"   # tool-level override
#
# [hooks.python]
# worker_startup = "scripts/py_setup.py"
#
# [hooks.python.pytest]
# worker_startup = "scripts/conftest_hook.py"


# ---------------------------------------------------------------------------
# [python]: interpreter resolution
# ---------------------------------------------------------------------------
# When unset, scrutin auto-detects in this order: $VIRTUAL_ENV, then
# .venv/ and venv/ in the project root, then $CONDA_PREFIX, then
# python3 on PATH.
#
# [python]
# venv        = "envs/test"          # path to a virtualenv directory
# interpreter = "uv run python"      # replaces auto-detection entirely;
#                                    # split on whitespace so wrappers work


# ---------------------------------------------------------------------------
# Per-tool config
# ---------------------------------------------------------------------------
# Custom runner scripts: `scrutin init` writes the embedded defaults to
# .scrutin/runners/<tool>.<ext> (e.g. .scrutin/runners/testthat.R,
# .scrutin/runners/scrutin_pytest.py). Edit those files in place to swap package
# loading, add project setup, or tweak the reporter; the engine picks
# them up automatically over the embedded default whenever present.
# Delete a file in that directory to fall back to the built-in runner.
# To point at a runner somewhere else in the repo, set `runner` on an
# explicit [[suite]] entry instead (see `runner` under [[suite]]).
#
# [pytest]
# extra_args = []                 # appended verbatim to pytest.main(),
#                                 # e.g. ["--tb=short", "-vv"]


# ---------------------------------------------------------------------------
# [keymap.<mode>]: TUI keybindings (replace semantics)
# ---------------------------------------------------------------------------
# Each [keymap.<mode>] subtable fully replaces the default bindings
# for that mode (replace, not overlay): deleting a line unbinds the
# key; deleting the whole subtable restores scrutin's built-in
# defaults for that mode. Modes: normal, detail, failure, help, log.
#
# Key syntax: single chars (`j`, `J`), named keys (`Enter`, `Esc`,
# `Tab`, `Space`, `Up`, `Down`, `PageUp`, `Backspace`, `F1`..`F12`),
# and modifiers (`ctrl+x`, `alt+x`, `shift+x`). Action names live
# in scrutin-tui::keymap::Action.
#
# The defaults for every mode are written out below by `scrutin init`
# so you can edit in place rather than reconstructing them from docs.

# [keymap.normal]
# "j"        = "cursor_down"
# "k"        = "cursor_up"
# "Down"     = "cursor_down"
# "Up"       = "cursor_up"
# "Right"    = "enter_detail"
# "Enter"    = "enter_detail"
# "l"        = "enter_detail"
# "Left"     = "pop"
# "Esc"      = "pop"
# "q"        = "quit"
# "g"        = "cursor_top"
# "G"        = "cursor_bottom"
# "Home"     = "cursor_top"
# "End"      = "cursor_bottom"
# "PageUp"   = "full_page_up"
# "PageDown" = "full_page_down"
# "J"        = "source_scroll_down"
# "K"        = "source_scroll_up"
# "r"        = "open_run_menu"
# "x"        = "cancel_file"
# "X"        = "cancel_all"
# "/"        = "filter_name"
# "o"        = "filter_status"
# "O"        = "filter_status_back"
# "t"        = "filter_tool"
# "T"        = "filter_tool_back"
# "f"        = "filter_group"
# "F"        = "filter_group_back"
# "s"        = "open_sort_menu"
# "\"        = "toggle_orientation"
# "("        = "shrink_list"
# ")"        = "grow_list"
# "Space"    = "toggle_select"
# "v"        = "toggle_visual"
# "e"        = "edit_test"
# "y"        = "yank_message"
# "L"        = "enter_log"
# "?"        = "enter_help"

# [keymap.detail]
# "j"        = "cursor_down"
# "k"        = "cursor_up"
# "Down"     = "cursor_down"
# "Up"       = "cursor_up"
# "Right"    = "enter_failure"
# "Enter"    = "enter_failure"
# "l"        = "enter_failure"
# "Left"     = "pop"
# "Esc"      = "pop"
# "h"        = "pop"
# "q"        = "quit"
# "g"        = "cursor_top"
# "G"        = "cursor_bottom"
# "Home"     = "cursor_top"
# "End"      = "cursor_bottom"
# "PageUp"   = "full_page_up"
# "PageDown" = "full_page_down"
# "J"        = "source_scroll_down"
# "K"        = "source_scroll_up"
# "r"        = "run_current_file"
# "R"        = "open_run_menu"
# "x"        = "cancel_file"
# "X"        = "cancel_all"
# "/"        = "filter_name"
# "o"        = "filter_status"
# "O"        = "filter_status_back"
# "t"        = "filter_tool"
# "T"        = "filter_tool_back"
# "f"        = "filter_group"
# "F"        = "filter_group_back"
# "s"        = "open_sort_menu"
# "\"        = "toggle_orientation"
# "("        = "shrink_list"
# ")"        = "grow_list"
# "e"        = "edit_test"
# "E"        = "edit_source"
# "y"        = "yank_message"
# "a"        = "diagnose_with_agent"
# "L"        = "enter_log"
# "?"        = "enter_help"

# [keymap.failure]
# "j"    = "cursor_down"
# "k"    = "cursor_up"
# "Down" = "cursor_down"
# "Up"   = "cursor_up"
# "Left" = "pop"
# "Esc"  = "pop"
# "h"    = "pop"
# "q"    = "quit"
# "r"    = "run_current_file"
# "R"    = "open_run_menu"
# "x"    = "cancel_file"
# "X"    = "cancel_all"
# "/"    = "filter_name"
# "e"    = "edit_test"
# "E"    = "edit_source"
# "y"    = "yank_message"
# "a"    = "diagnose_with_agent"
# "L"    = "enter_log"
# "?"    = "enter_help"

# [keymap.help]
# "j"        = "cursor_down"
# "k"        = "cursor_up"
# "Down"     = "cursor_down"
# "Up"       = "cursor_up"
# "g"        = "cursor_top"
# "G"        = "cursor_bottom"
# "PageDown" = "cursor_down"
# "PageUp"   = "cursor_up"
# "Esc"      = "pop"
# "q"        = "pop"
# "?"        = "pop"

# [keymap.log]
# "j"        = "cursor_down"
# "k"        = "cursor_up"
# "Down"     = "cursor_down"
# "Up"       = "cursor_up"
# "g"        = "cursor_top"
# "G"        = "cursor_bottom"
# "PageDown" = "cursor_down"
# "PageUp"   = "cursor_up"
# "Esc"      = "pop"
# "q"        = "pop"
# "?"        = "pop"
# "L"        = "pop"


================================================
FILE: DESCRIPTION
================================================
Type: Package
Package: countrycode
Title: Convert Country Names and Country Codes
Version: 1.8.0
Authors@R: 
    c(person(given = "Vincent",
             family = "Arel-Bundock",
             role = c("aut", "cre"),
             email = "vincent.arel-bundock@umontreal.ca",
             comment = c(ORCID = "0000-0003-2042-7063")),
      person(given = "CJ",
             family = "Yetman",
             role = "ctb",
             email = "cj@cjyetman.com",
             comment = c(ORCID = "0000-0001-5099-9500")),
      person(given = "Nils",
             family = "Enevoldsen",
             role = "ctb",
             email = "nils@wlonk.com",
             comment = c(ORCID = "0000-0001-7195-4117")),
      person("Etienne", "Bacher",
             email = "etienne.bacher@protonmail.com",
             role = "ctb",
             comment = c(ORCID = "0000-0002-9271-5075")),
      person(given = "Samuel",
             family = "Meichtry",
             role = "ctb",
             email = "samuel.meichtry@bj.admin.ch",
             comment = c(ORCID = "0000-0003-2165-791X")))
Description: Standardize country names, convert them into one of 40
    different coding schemes, convert between coding schemes, and assign
    region descriptors.
License: GPL-3
URL: https://vincentarelbundock.github.io/countrycode/
BugReports: https://github.com/vincentarelbundock/countrycode/issues
Depends:
    R (>= 2.10)
Suggests:
    altdoc,
    eurostat,
    testthat,
    tibble,
    ISOcodes,
    utf8
Encoding: UTF-8
LazyData: yes
LazyLoad: yes
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.3


================================================
FILE: LICENSE
================================================
                    GNU GENERAL PUBLIC LICENSE
                       Version 3, 29 June 2007

 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

                            Preamble

  The GNU General Public License is a free, copyleft license for
software and other kinds of works.

  The licenses for most software and other practical works are designed
to take away your freedom to share and change the works.  By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.  We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors.  You can apply it to
your programs, too.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.

  To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights.  Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.

  For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received.  You must make sure that they, too, receive
or can get the source code.  And you must show them these terms so they
know their rights.

  Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.

  For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software.  For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.

  Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so.  This is fundamentally incompatible with the aim of
protecting users' freedom to change the software.  The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable.  Therefore, we
have designed this version of the GPL to prohibit the practice for those
products.  If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.

  Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary.  To prevent this, the GPL assures that
patents cannot be used to render the program non-free.

  The precise terms and conditions for copying, distribution and
modification follow.

                       TERMS AND CONDITIONS

  0. Definitions.

  "This License" refers to version 3 of the GNU General Public License.

  "Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.

  "The Program" refers to any copyrightable work licensed under this
License.  Each licensee is addressed as "you".  "Licensees" and
"recipients" may be individuals or organizations.

  To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy.  The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.

  A "covered work" means either the unmodified Program or a work based
on the Program.

  To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy.  Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.

  To "convey" a work means any kind of propagation that enables other
parties to make or receive copies.  Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.

  An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License.  If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.

  1. Source Code.

  The "source code" for a work means the preferred form of the work
for making modifications to it.  "Object code" means any non-source
form of a work.

  A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.

  The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form.  A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.

  The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities.  However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work.  For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.

  The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.

  The Corresponding Source for a work in source code form is that
same work.

  2. Basic Permissions.

  All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met.  This License explicitly affirms your unlimited
permission to run the unmodified Program.  The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work.  This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.

  You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force.  You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright.  Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.

  Conveying under any other circumstances is permitted solely under
the conditions stated below.  Sublicensing is not allowed; section 10
makes it unnecessary.

  3. Protecting Users' Legal Rights From Anti-Circumvention Law.

  No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.

  When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.

  4. Conveying Verbatim Copies.

  You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.

  You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.

  5. Conveying Modified Source Versions.

  You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:

    a) The work must carry prominent notices stating that you modified
    it, and giving a relevant date.

    b) The work must carry prominent notices stating that it is
    released under this License and any conditions added under section
    7.  This requirement modifies the requirement in section 4 to
    "keep intact all notices".

    c) You must license the entire work, as a whole, under this
    License to anyone who comes into possession of a copy.  This
    License will therefore apply, along with any applicable section 7
    additional terms, to the whole of the work, and all its parts,
    regardless of how they are packaged.  This License gives no
    permission to license the work in any other way, but it does not
    invalidate such permission if you have separately received it.

    d) If the work has interactive user interfaces, each must display
    Appropriate Legal Notices; however, if the Program has interactive
    interfaces that do not display Appropriate Legal Notices, your
    work need not make them do so.

  A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit.  Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.

  6. Conveying Non-Source Forms.

  You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:

    a) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by the
    Corresponding Source fixed on a durable physical medium
    customarily used for software interchange.

    b) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by a
    written offer, valid for at least three years and valid for as
    long as you offer spare parts or customer support for that product
    model, to give anyone who possesses the object code either (1) a
    copy of the Corresponding Source for all the software in the
    product that is covered by this License, on a durable physical
    medium customarily used for software interchange, for a price no
    more than your reasonable cost of physically performing this
    conveying of source, or (2) access to copy the
    Corresponding Source from a network server at no charge.

    c) Convey individual copies of the object code with a copy of the
    written offer to provide the Corresponding Source.  This
    alternative is allowed only occasionally and noncommercially, and
    only if you received the object code with such an offer, in accord
    with subsection 6b.

    d) Convey the object code by offering access from a designated
    place (gratis or for a charge), and offer equivalent access to the
    Corresponding Source in the same way through the same place at no
    further charge.  You need not require recipients to copy the
    Corresponding Source along with the object code.  If the place to
    copy the object code is a network server, the Corresponding Source
    may be on a different server (operated by you or a third party)
    that supports equivalent copying facilities, provided you maintain
    clear directions next to the object code saying where to find the
    Corresponding Source.  Regardless of what server hosts the
    Corresponding Source, you remain obligated to ensure that it is
    available for as long as needed to satisfy these requirements.

    e) Convey the object code using peer-to-peer transmission, provided
    you inform other peers where the object code and Corresponding
    Source of the work are being offered to the general public at no
    charge under subsection 6d.

  A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.

  A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling.  In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage.  For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product.  A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.

  "Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source.  The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.

  If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information.  But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).

  The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed.  Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.

  Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.

  7. Additional Terms.

  "Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law.  If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.

  When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it.  (Additional permissions may be written to require their own
removal in certain cases when you modify the work.)  You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.

  Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:

    a) Disclaiming warranty or limiting liability differently from the
    terms of sections 15 and 16 of this License; or

    b) Requiring preservation of specified reasonable legal notices or
    author attributions in that material or in the Appropriate Legal
    Notices displayed by works containing it; or

    c) Prohibiting misrepresentation of the origin of that material, or
    requiring that modified versions of such material be marked in
    reasonable ways as different from the original version; or

    d) Limiting the use for publicity purposes of names of licensors or
    authors of the material; or

    e) Declining to grant rights under trademark law for use of some
    trade names, trademarks, or service marks; or

    f) Requiring indemnification of licensors and authors of that
    material by anyone who conveys the material (or modified versions of
    it) with contractual assumptions of liability to the recipient, for
    any liability that these contractual assumptions directly impose on
    those licensors and authors.

  All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10.  If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term.  If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.

  If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.

  Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.

  8. Termination.

  You may not propagate or modify a covered work except as expressly
provided under this License.  Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).

  However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.

  Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.

  Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License.  If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.

  9. Acceptance Not Required for Having Copies.

  You are not required to accept this License in order to receive or
run a copy of the Program.  Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance.  However,
nothing other than this License grants you permission to propagate or
modify any covered work.  These actions infringe copyright if you do
not accept this License.  Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.

  10. Automatic Licensing of Downstream Recipients.

  Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License.  You are not responsible
for enforcing compliance by third parties with this License.

  An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations.  If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.

  You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License.  For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.

  11. Patents.

  A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based.  The
work thus licensed is called the contributor's "contributor version".

  A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version.  For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.

  Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.

  In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement).  To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.

  If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients.  "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.

  If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.

  A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License.  You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.

  Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.

  12. No Surrender of Others' Freedom.

  If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all.  For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.

  13. Use with the GNU Affero General Public License.

  Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work.  The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.

  14. Revised Versions of this License.

  The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time.  Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

  Each version is given a distinguishing version number.  If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation.  If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.

  If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.

  Later license versions may give you additional or different
permissions.  However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.

  15. Disclaimer of Warranty.

  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

  16. Limitation of Liability.

  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.

  17. Interpretation of Sections 15 and 16.

  If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.

                     END OF TERMS AND CONDITIONS

            How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

  To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) <year>  <name of author>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

  If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:

    <program>  Copyright (C) <year>  <name of author>
    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License.  Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".

  You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.

  The GNU General Public License does not permit incorporating your program
into proprietary programs.  If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library.  If this is what you want to do, use the GNU Lesser General
Public License instead of this License.  But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.


================================================
FILE: Makefile
================================================
.PHONY: help website dictionary

help:  ## Display this help screen
	@echo -e "\033[1mAvailable commands:\033[0m\n"
	@grep -E '^[a-z.A-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "  \033[36m%-18s\033[0m %s\n", $$1, $$2}' | sort

dictionary: ## dictionary
	R CMD BATCH dictionary/build.R

document:  ## document
	Rscript -e "devtools::document()"

check:  document ## check
	Rscript -e "devtools::check()"

install: document  ## install
	Rscript -e "devtools::install(dependencies = TRUE)"

test: install ## test
	Rscript -e "library(countrycode);devtools::test()"

website: install ## render vignettes and website
	Rscript -e "altdoc::render_docs(verbose = TRUE)"
	# rm -rf _quarto
	# rm -rf ~/Downloads/countrycode_website && cp -r docs ~/Downloads/countrycode_website


================================================
FILE: NAMESPACE
================================================
# Generated by roxygen2: do not edit by hand

export(countrycode)
export(countryname)
export(get_dictionary)
export(guess_field)


================================================
FILE: NEWS.md
================================================
# News

## 1.8.0

* New Spanish regular expressions and names: `country.name.es`, `cldr.name.es` and `country.name.es`. Thanks to @dieghernan for the contribution, and to @NilsEnevoldsen and @cjyetman for review.
* Misc regex improvements and testing. Thanks to @NilsEnevoldsen.

## 1.7.0

* Add `telephone` as a new code from ITU-T E.164 country codes for telecommunication.
* Add coverage for historical Gleditsch & Ward polities (including United Provinces of Central America, Transvaal, and Tibet) and regression tests. Thanks to @JoeNoonan for Issue #320.
* `custom_match` now suppresses ambiguity and duplicate-match warnings for overridden values. Thanks to @victorhartman and @NilsEnevoldsen for the report and analysis (Issue #364).
* Stricter Micronesia regular expressions. Thanks to @mattkerlogue, @stefgehrig, @cjyetman, @NilsEnevoldsen for discussion in Issue #354.
* `TÜRKİYE` (dotted capital İ) now matches Turkey. Thanks to @cjyetman and @NilsEnevoldsen for report #347.
* Update many dictionaries to the latest versions from publishing organizations. Thanks to @NilsEnevoldsen.
* Improve Ireland regular expressions and add tests. Issue #313.
* Improve Germany / East Germany regular expressions and add tests. Issue #313.
* Update ISO4217 currency codes. Thanks to @cjyetman.

## countrycode 1.6.1

* The `simplify` argument in `apply` was introduced in R 4.1.0. We used it, which broke usage of countrycode on older versions of R.
* `genc` code improvements.

## countrycode 1.6.0

* Important speed-up for detection of country names using regular expressions (Thanks to Etienne Bacher).
* `countryname` gets the `nomatch` argument.
* `countryname` returns NA when the code does not support a given country. (Issue #336)
* Improved regex for Italy
* `eurocontrol_statfor` updated: ESRA->ECAC to account for redistribution: https://www.eurocontrol.int/sites/default/files/2020-11/eurocontrol-forecast-2020-2024-region-definition.pdf Thanks to @sthonnard for contribution #352.
* Antarctica now has a "continent" value. Thanks to @geryan for report #353.

## countrycode 1.5.0

* `get_dictionary()` function to download custom dictionaries (cross-walks):
  - US States, Swiss Cantons, Global Burden of Disease, ExioBase, GTAP.
* New codes: Polity V "p5c", "p5n"
* New code "unhcr_region". Thanks to @galalH for code contribution #329
* Many regex improvements
* Several minor bug fixes

## countrycode 1.4.0

* Detect French country names using regular expressions: `origin = "country.name.fr"` (Thanks to Samuel Meichtry)
* Detect Italian country names using regular expressions: `origin = "country.name.it"` (Thanks to Samuel Meichtry)

## countrycode 1.3.1

* New code: unhcr

## countrycode 1.3.0

* destination argument accepts a vector of strings and tries one after the other
* countryname(warn=TRUE) by default
* better class checks
* countryname defaults to `country.name.en` for missing country names (nomatch=NULL)
* Vietnam: better regex and support for vdem
* Namibia fixes: eurostat, genc2c, wb_api2c, ecb
* Various regex improvements
* Congo French disambiguation

## countrycode 1.2.0

* New 'countryname' function converts country names from any language (thanks to @davidsjoberg)
* New `guess_field` function guesses which code a vector uses
* Bug in dict build inserted NA in region variable (Thanks to M. Pascariu)
* Added region23 with the old, more granular regions
* Added unicode.symbol, which converts to emoji flags
* Added ISO 4217 currency name, alpha, and numeric codes
* Added UN region codes and names
* Added IANA ccTLD codes
* Improved various regexes

## countrycode 1.1.3 

* Added Demographic and Health Surveys (thanks to @mcooper)

## countrycode 1.1.2 

* Updated World Bank regions with manual additions

## countrycode 1.1.1 

* Bug: Typo prevented users for using "p4n" as origin code
* Fixed bad icao.region codes (Thanks to @espinielli)
* Added country name "United Arab Republic" and its regex (Thanks to Gina Reynolds)
* Added SOM to wb code (Thanks to Fabian Besche)
* Added Vietnam to codelist_panel

## countrycode 1.1.0 

* Gleditsch and Ward codes (Thanks to Altaf Ali)
* V-Dem 8 country codes (panel and cross-section)
* Fixed Netherlands Antilles test (ANT code retired by ISO)
* codelist_panel now excludes years where a country didn't exist
* Scraping function for UN M49 codes. (Thanks to @cjyetman and @emilBeBri)
* `nomatch = NULL` now works as expected when sourcvar is a factor (#192 thanks to @jhuovari for reporting)

## countrycode 1.0.0 

* Huge thanks to @cjyetman for his incredible work on this major release!
* Country-Year (panel) conversion dictionary
* Dictionary built from original sources
* Liechtenstein should not be in eu28
* Russia eurocontrol region fix
* CLRD country names

## countrycode 0.19.1 

* Move to Semantic Versioning 2.0.0
  http://semver.org/#semantic-versioning-specification-semver
* Fixed North Korea regex and added tests
* Fixed Sudan iso3n code
* Removed lookbehind from Ireland regex for javascript compatibility (request by plotly)
* Added nomatch argument

## countrycode 0.19 

New features

* "custom_dict" argument allows user-supplied dictionary data.frames
* "custom_match" argument allows a user-supplied named vector of custom
  origin->destination matches that will supercede any matching values in the
  default result (issue #107) (Thanks to @cjyetman)
* German, French, Spanish, Russian, Chinese, and Arabic country names as destination codes
* German regular expression to convert from German names to codes. (Thanks to @sumtxt)
* Aviation codes (Thanks to Enrico Spinielli)
* ar5 and eu28 (Thanks to Niklas Roming)
* eurostat (Thanks to @cjyetman)
* 2 and 3 character codes for the World Bank API: wb_api2c and wb_api3c (Thanks to @cjyetman)
* alpha and numeric codes for Polity IV: p4_scode and p4_ccode (Thanks to @cjyetman)
* World Values Survey numeric code (Thanks to @cjyetman)

Regex fixes and improvements:

* Improved regex for Ireland and United States of America (Thanks to @cjyetman)
* D.R. Congo (found in WVS) matches Democratic Republic of the Congo (Thanks to @cjyetman)
* Southern Africa
* Federated States of Micronesia
* Republic of China == Taiwan (Thanks to Nils Enevoldsen)
* Martinique (Thanks to Martyn Plummer)
* Tahiti country name string converts to French Polynesia

Misc:

* Major speed-up in regex conversion by using factors (Thanks to @cjyetman)
* when more than one match is found for a given string, <NA> is returned rather
  than arbitrarily choosing the last match found (Thanks to @cjyetman)
* updated tests to new testthat convention (Thanks to @cjyetman)
* English country names are now official UN versions
* Better docs, examples, and README
* Taiwan FAO code is 214 (Thanks to Matthieu Stigler)

## countrycode 0.18 

* Nils Enevoldsen did wonderful work refactoring most of the regex in the dictionary.
* Nils also added a bunch of tests. Thanks!
* Added Tokelau

## countrycode 0.17 

* Added International Olympic Committee codes (Thanks to Devon Meunier)
* Bug: fips04 -> fips104 (Thanks to Florian Hollenbach)
* Complete FIPS104 codes (Thanks to Andy Halterman)
* Generic code name validity check (Thanks to Stefan Zeugner)
* Fixed IMF codes (Thanks to Stefan Zeugner)
* Regex fix to work better with Database of Political Insitutions (Thanks to Christopher Gandrud)
* Avoids confusion with Eq Guinea (Thanks to Christopher Gandrud)

## countrycode 0.16 

* Bug: NA cowc -> ABW (Thanks to Jon Mellon)

## countrycode 0.15 

* Regex fixes
    - Guinea
    - West Bank
    - Kitts / Christopher
    - Georgia / India
    - Mali
    - Sudan nigeria
    - Belgium
    - Korea Somalia
    - Oman

## countrycode 0.14 

* sint maarten typo

## countrycode 0.13 

* add sint maartin & curacao (thanks johnb30)

## countrycode 0.12 

* Missing wb codes filled-in using iso3c
* Added South Sudan
* Thanks to Rod Alence!

## countrycode 0.11 

* Vietnam cown
* Regexes:
    - Dominica / Dominican Republic
    - New Zealand / Aland

## countrycode 0.10 

* De-duplicate Sudan
* Niger vs. Nigeria regex

## countrycode 0.9 

* Fixed regexes: Mali, Korea, Oman, Dominica

## countrycode 0.8 

* Added World Bank (wb) country codes. Very similar, but slightly different from iso3c.

## countrycode 0.7

* Removed useless functions countrycode.nomatch and countryframe
* Fixed 2 Congo-related problems
* Added option for countrycode() to report codes for which no match was found
* Moved documentation to roxygen2
* Fixed Trinidad Tobago regex
* Added UN and FAO country codes


================================================
FILE: R/cldr_examples.R
================================================
#' List of CLDR country name codes and associated examples
#'
#' \itemize{
#'   \item Code: CLDR code
#'   \item Example: French Southern Territories in different languages
#' }
#' @docType data
#' @keywords datasets
#' @name cldr_examples
#' @usage cldr_examples
#' @format data frame
NULL


================================================
FILE: R/codelist.R
================================================
#' Country Code Translation Data Frame (Cross-Sectional)
#'
#' A data frame used internally by the [countrycode()] function. `countrycode` can use any valid code as destination, but only some codes can be used as origin.
#'
#' ## Origin and Destination
#'
#' - `cctld`: IANA country code top-level domain
#' - `country.name.en`: country name (English)
#' - `country.name.de`: country name (German)
#' - `country.name.fr`: country name (French)
#' - `country.name.it`: country name (Italian)
#' - `country.name.es`: country name (Spanish)
#' - `cowc`: Correlates of War character
#' - `cown`: Correlates of War numeric
#' - `dhs`: Demographic and Health Surveys Program
#' - `ecb`: European Central Bank
#' - `eurostat`:  Eurostat
#' - `fao`: Food and Agriculture Organization of the United Nations numerical code
#' - `fips`: FIPS 10-4 (Federal Information Processing Standard)
#' - `gaul`: Global Administrative Unit Layers
#' - `genc2c`: GENC 2-letter code
#' - `genc3c`: GENC 3-letter code
#' - `genc3n`: GENC numeric code
#' - `gwc`: Gleditsch & Ward character
#' - `gwn`: Gleditsch & Ward numeric
#' - `imf`: International Monetary Fund (Warning: The IMF generally uses ISO codes. These codes are WEO-related, but may be inconsistently used in the wild.)
#' - `ioc`: International Olympic Committee
#' - `iso2c`: ISO-2 character
#' - `iso3c`: ISO-3 character
#' - `iso3n`: ISO-3 numeric
#' - `p5n`: Polity V numeric country code
#' - `p5c`: Polity V character country code
#' - `p4n`: Polity IV numeric country code
#' - `p4c`: Polity IV character country code
#' - `un`: United Nations M49 numeric codes
#' - `unicode.symbol`: Region subtag (often displayed as emoji flag)
#' - `unhcr`: United Nations High Commissioner for Refugees
#' - `unpd`: United Nations Procurement Division
#' - `vdem`: Varieties of Democracy (V-Dem version 8, April 2018)
#' - `wb`: World Bank (very similar but not identical to iso3c)
#' - `wvs`: World Values Survey numeric code
#'
#' ## Destination only
#'
#' - `cldr.*`: 600+ country name variants from the UNICODE CLDR project (e.g., "cldr.short.en").
#'   Inspect the [`cldr_examples`][countrycode::cldr_examples] data.frame for a full list of
#'   available country names and examples.
#' - `ar5`: IPCC's regional mapping used both in the Fifth Assessment Report
#'              (AR5) and for the Reference Concentration Pathways (RCP)
#' - `continent`: Continent as defined in the World Bank Development Indicators
#' - `cow.name`: Correlates of War country name
#' - `currency`: ISO 4217 currency name
#' - `eurocontrol_pru`:  European Organisation for the Safety of Air Navigation
#' - `eurocontrol_statfor`:  European Organisation for the Safety of Air Navigation
#' - `eu28`: Member states of the European Union (as of December 2015),
#'               without special territories
#' - `icao.region`: International Civil Aviation Organization region
#' - `iso.name.en`: ISO English short name
#' - `iso.name.fr`: ISO French short name
#' - `iso4217c`: ISO 4217 currency alphabetic code
#' - `iso4217n`: ISO 4217 currency numeric code
#' - `p4.name`: Polity IV country name
#' - `region`: 7 Regions as defined in the World Bank Development Indicators
#' - `region23`: 23 Regions as used to be in the World Bank Development Indicators (legacy)
#' - `telephone`: ITU-T E.164 country codes for telecommunication
#' - `un.name.ar`: United Nations Arabic country name
#' - `un.name.en`: United Nations English country name
#' - `un.name.es`: United Nations Spanish country name
#' - `un.name.fr`: United Nations French country name
#' - `un.name.ru`: United Nations Russian country name
#' - `un.name.zh`: United Nations Chinese country name
#' - `un.region.name`: United Nations region name
#' - `un.region.code`: United Nations region code
#' - `un.regionintermediate.name`: United Nations intermediate region name
#' - `un.regionintermediate.code`: United Nations intermediate region code
#' - `un.regionsub.name`: United Nations sub-region name
#' - `un.regionsub.code`: United Nations sub-region code
#' - `unhcr.region`: United Nations High Commissioner for Refugees region name
#' - `wvs.name`: World Values Survey numeric code country name
#'
#' @note The Correlates of War (cow) and Polity 4 (p4) project produce codes in
#' country year format. Some countries go through political transitions that
#' justify changing codes over time. When building a purely cross-sectional
#' conversion dictionary, this forces us to make arbitrary choices with respect
#' to some entities (e.g., Western Germany, Vietnam, Serbia). `countrycode`
#' includes a reconciled dataset in panel format,
#' [`codelist_panel`][countrycode::codelist_panel]. Instead of converting code, we recommend
#' that users dealing with panel data "left-merge" their data into this panel
#' dictionary.
#'
#' @docType data
#' @keywords datasets
#' @name codelist
#' @format A data frame with codes as columns.
NULL


================================================
FILE: R/codelist_panel.R
================================================
#' Country Code Translation Data Frame (Country-Year Panel)
#'
#' A panel of country-year observations with various codes
#'
#' @docType data
#' @keywords datasets
#' @name codelist_panel
#' @usage codelist_panel
#' @format data frame with codes as columns
NULL


================================================
FILE: R/countrycode-package.R
================================================
#' Convert country codes or country names
#'
#' The \code{countrycode} function can convert to and from several different
#' country coding schemes.  It uses regular expressions to convert country
#' names (e.g. Sri Lanka) into any of those coding schemes, or into
#' standardized country names in several languages.  It can create variables
#' with the name of the continent and/or several regional groupings to which
#' each country belongs.
#'
#' Type ?codelist to get a list of available origin and destination
#' codes.
#'
#' @name countrycode-package
#' @aliases countrycode-package
#' @title Convert Country Codes or Country Names
#' @author Vincent Arel-Bundock \email{vincent.arel-bundock@umontreal.ca}
#' @references
#'     \url{http://arelbundock.com}
#'     \url{https://github.com/vincentarelbundock/countrycode}
#' @noRd
#' @keywords internal
"_PACKAGE"


================================================
FILE: R/countrycode.R
================================================
#' Convert Country Codes
#'
#' Converts long country names into one of many different coding schemes.
#' Translates from one scheme to another. Converts country name or coding
#' scheme to the official short English country name. Creates a new variable
#' with the name of the continent or region to which each country belongs.
#'
#' @note
#' For a complete description of available country codes and languages,
#' please see the documentation for the [`codelist`][codelist] conversion
#' dictionary.
#'
#' Panel data (i.e., country-year) can pose particular problems when
#' converting codes. For instance, some countries like Vietnam or Serbia go
#' through political transitions that justify changing codes over time. This
#' can pose problems when using codes from organizations like CoW or Polity IV,
#' which produce codes in country-year format. Instead of converting codes
#' using `countrycode()`, we recommend that users use the
#' [`codelist_panel`][codelist_panel] data.frame as a base into which they can
#' merge their other data. This data.frame includes most relevant code, and is
#' already "reconciled" to ensure that each political unit is only represented
#' by one row in any given year. From there, it is just a matter of using [merge()]
#' to combine different datasets which use different codes.
#'
#' @param sourcevar Vector which contains the codes or country names to be
#'   converted (character or factor)
#' @param origin A string which identifies the coding scheme of origin (e.g., `"iso3c"`). See
#'   [`codelist`][codelist] for a list of available codes.
#' @param destination A string or vector of strings which identify the coding
#'   scheme of destination (e.g., `"iso3c"` or `c("cowc", "iso3c")`). See
#'   [`codelist`][codelist] for a list of available codes. When users supply a
#'   vector of destination codes, they are used sequentially to fill in
#'   missing values not covered by the previous destination code in the
#'   vector.
#' @param warn Prints unique elements from sourcevar for which no match was found
#' @param nomatch When countrycode fails to find a match for the code of
#'   origin, it fills-in the destination vector with `nomatch`. The default
#'   behavior is to fill non-matching codes with `NA`. If `nomatch = NULL`,
#'   countrycode tries to use the origin vector to fill-in missing values in the
#'   destination vector. `nomatch` must be either `NULL`, of length 1, or of the same
#'   length as `sourcevar`.
#' @param custom_dict A data frame which supplies a new dictionary to
#'   replace the built-in country code dictionary. Each column
#'   contains a different code and must include no duplicates. The
#'   data frame format should resemble [`codelist`][codelist]. Users
#'   can pre-assign attributes to this custom dictionary to affect
#'   behavior (see Examples section):
#'   \itemize{
#'   \item "origin.regex" attribute: a character vector with the names
#'     of columns containing regular expressions.
#'   \item "origin.valid" attribute: a character vector with the names
#'     of columns that are accepted as valid origin codes.
#'   }
#' @param custom_match A named vector which supplies custom origin and
#'   destination matches that will supercede any matching default result. The name
#'   of each element will be used as the origin code, and the value of each
#'   element will be used as the destination code. Values supplied via
#'   `custom_match` supersede ambiguous or duplicate matches and will not
#'   trigger the corresponding ambiguity/duplicate-match warnings for those
#'   values.
#' @param origin_regex NULL or Logical: When using a custom
#'   dictionary, if TRUE then the origin codes will be matched as
#'   regex, if FALSE they will be matched exactly. When NULL,
#'   `countrycode` will behave as TRUE if the origin name is in the
#'   `custom_dictionary`'s `origin_regex` attribute, and FALSE
#'   otherwise. See examples section below.
#' @keywords countrycode
#' @export
#' @aliases countrycode
#' @examples
#' library(countrycode)
#'
#' # ISO to Correlates of War
#' countrycode(c('USA', 'DZA'), origin = 'iso3c', destination = 'cown')
#'
#' # English to ISO
#' countrycode('Albania', origin = 'country.name', destination = 'iso3c')
#'
#' # German to French
#' countrycode('Albanien', origin = 'country.name.de', destination = 'iso.name.fr')
#'
#' # Using custom_match to supercede default codes
#' countrycode(c('United States', 'Algeria'), 'country.name', 'iso3c')
#' countrycode(c('United States', 'Algeria'), 'country.name', 'iso3c',
#'             custom_match = c('Algeria' = 'ALG'))
#'
#' x <- c("canada", "antarctica")
#' countryname(x)
#' countryname(x, destination = "cowc", warn = FALSE)
#' countryname(x, destination = "cowc", warn = FALSE, nomatch = x)
#'
countrycode <- function(sourcevar, origin, destination, warn = TRUE, nomatch = NA,
                        custom_dict = NULL, custom_match = NULL, origin_regex = NULL) {

    # default dictionary
    if (is.null(custom_dict)) {
        dictionary <- countrycode::codelist
        attr(dictionary, "origin_valid") <- c(
            "cctld", "country.name", "country.name.de", "country.name.fr", "country.name.it",
            "cowc", "cown", "dhs", "ecb", "eurostat", "fao", "fips", "gaul",
            "genc2c", "genc3c", "genc3n", "gwc", "gwn", "imf", "ioc", "iso2c",
            "iso3c", "iso3n", "p5c", "p5n", "p4c", "p4n", "un", "un_m49", "unicode.symbol",
            "unhcr", "unpd", "vdem", "wb", "wb_api2c", "wb_api3c", "wvs",
            "country.name.en.regex", "country.name.de.regex", "country.name.fr.regex",
            "country.name.it.regex", "country.name.es.regex")
        attr(dictionary, "origin_regex") <- c("country.name.de.regex",
                                              "country.name.en.regex",
                                              "country.name.fr.regex",
                                              "country.name.it.regex",
                                              "country.name.es.regex")
    } else {
        dictionary <- custom_dict
    }

    # default country names (only for default dictionary)
    if (is.null(custom_dict)) {
        if (origin == 'country.name') {
            origin <- 'country.name.en'
        }
        if (origin %in% c('country.name.en', 'country.name.de', 'country.name.it', 'country.name.fr', 'country.name.es')) {
            origin <- paste0(origin, '.regex')
        }
        destination[destination == "country.name"] <- 'country.name.en'
    }

    # dictionary attributes
    if (is.null(attr(dictionary, "origin_valid"))) {
        origin_valid <- colnames(dictionary)
    } else {
        origin_valid <- attr(dictionary, "origin_valid")
    }

    if (is.null(attr(dictionary, "destination_valid"))) {
        destination_valid <- colnames(dictionary)
    } else {
        destination_valid <- attr(dictionary, "destination_valid")
    }

    if (is.null(origin_regex)) { # user can override
        if (!is.null(attr(dictionary, "origin_regex"))) {
            origin_regex <- origin %in% attr(dictionary, "origin_regex")
        } else {
            origin_regex <- FALSE
        }
    }

    # Allow tibbles as conversion dictionary
    if('tbl_df' %in% class(dictionary)){ # allow tibble
        dictionary <- as.data.frame(dictionary)
    }

    # Sanity checks
    if (missing(sourcevar)) {
        stop('sourcevar is NULL (does not exist).')
    }

    if (!mode(sourcevar) %in% c('character', 'numeric')) {
        stop('sourcevar must be a character or numeric vector. This error often arises when users pass a tibble (e.g., from dplyr) instead of a column vector from a data.frame (i.e., my_tbl[, 2] vs. my_df[, 2] vs. my_tbl[[2]]). This can also happen when `sourcevar` is entirely composed of `NA`, which `R` treats as entries of class logical.')
    }

    if (!is.null(nomatch) & (length(nomatch) != 1) & (length(nomatch) != length(sourcevar))) {
        stop('nomatch needs to be NULL, or of length 1 or ', length(sourcevar), '.')
    }

    if (!is.character(origin) ||
        length(origin) != 1 ||
        !origin %in% origin_valid) {
        stop(sprintf("The `origin` argument must be a string of length 1 equal to one of these values: %s.",
                     paste(origin_valid, collapse = ", ")))
    }

    if (!is.character(destination) ||
        !all(destination %in% destination_valid)) {
        stop("The `destination` argument must be a string or a vector of strings where each element is equal to one of the column names in the conversion directory (by default: `codelist`).")
    }

    if(!inherits(dictionary, "data.frame")) {
        stop("The `dictionary` argument must be a data frame or tibble with codes as columns.")
    }

    dups = any(duplicated(stats::na.omit(dictionary[, origin])))
    if(dups){
        stop("Countrycode cannot accept dictionaries with duplicated origin codes")
    }

    # Copy origin_vector for later re-use
    origin_vector <- sourcevar

    # Case-insensitive matching
    if(is.null(custom_dict)){ # only for built-in dictionary
        # unicode.symbol breaks uppercase on Windows R-devel 2022-02-02; rejected by CRAN
        if(inherits(origin_vector, 'character') & !grepl('country|unicode.symbol', origin)){
            # only apply toupper() on unique values and match after.
            # much faster than applying toupper() on the whole vector
            # when vector is very large
            uniques <- unique(origin_vector)
            uppercase <- toupper(uniques)
            origin_vector <- unname(uppercase[match(origin_vector, uniques)])
        }
    }

    out <- rep(NA, length(sourcevar))
    for (dest in destination) {
        if (length(destination) == 1) {
            out <- countrycode_convert(
                ## user-supplied arguments
                sourcevar = sourcevar,
                origin = origin,
                destination = dest,
                warn = warn,
                nomatch = nomatch,
                custom_dict = custom_dict,
                custom_match = custom_match,
                origin_regex = origin_regex,
                ## countrycode-supplied arguments
                origin_vector = origin_vector,
                dictionary = dictionary)
        } else {
            out <- ifelse(is.na(out),
                          countrycode_convert(
                              ## user-supplied arguments
                              sourcevar = sourcevar,
                              origin = origin,
                              destination = dest,
                              warn = warn,
                              nomatch = nomatch,
                              custom_dict = custom_dict,
                              custom_match = custom_match,
                              origin_regex = origin_regex,
                              ## countrycode-supplied arguments
                              origin_vector = origin_vector,
                              dictionary = dictionary),
                          out)
        }
    }
    return(out)
}


#' internal function called by `countrycode()`
#'
#' @keywords internal
#' @noRd
countrycode_convert <- function(# user-supplied arguments
                                sourcevar,
                                origin,
                                destination,
                                warn,
                                nomatch,
                                custom_dict,
                                custom_match,
                                origin_regex,
                                # countrycode-supplied arguments
                                origin_vector,
                                dictionary
                                ) {


    # Convert
    if (origin_regex) { # regex codes
        dict <- stats::na.omit(dictionary[, c(origin, destination)])
        sourcefctr <- factor(origin_vector)

        # possibilities (add NA so there's at least one item)
        choices <- c(levels(sourcefctr), NA)
        # sometimes an error is triggered by encoding issues
        choices <- tryCatch(trimws(choices), error = function(e) choices)

        # Apply all regexes on all inputs. This gives a matrix where rows
        # are the inputs and columns are the regexes.
        # For each row, the `TRUE` values indicate the matches.
        matchidx <- sapply(dict[[origin]], grepl, x = choices,
                           perl = TRUE, ignore.case = TRUE)
        if (all(is.na(choices))) {
            matches <- vector("list", length = length(choices))
        } else {
            # Issue reported to Vincent by email
            # simplify=FALSE was introduced in R 4.1.0. we want coverage before
            # out <- try(apply(matchidx, 1, which, simplify = FALSE))
            out <- apply(matchidx, 1, which)
            if (length(out) == 0) {
                out <- rep(list(NULL), nrow(matchidx))
            }
            names(out) <- choices
            matches <- lapply(out, function(x) dict[x, destination])
        }


        # fill elements that have zero matches with the appropriate NA
        matches[sapply(matches, length) == 0] <- `class<-`(NA, class(dict[[destination]]))

        # create destination_list with elements that have more than one match
        destination_list <- matches[sapply(matches, length) > 1]

        # add origin_vector value to beginning of match results to replicate previous behavior
        destination_list <- Map(c, names(destination_list), destination_list)

        # set elements with multiple matches to the appropriate NA
        matches[sapply(matches, length) > 1] <- `class<-`(NA, class(dict[[destination]]))

        # remove all but last match to replicate previous behavior
        matches <- sapply(matches, function(x) { x[length(x)] })

        # replace with custom matches if set
        if (!is.null(custom_match)) {
          matchidxs <- match(names(matches), names(custom_match))
          cust_matched <- !is.na(matchidxs)
          matches[cust_matched] <- custom_match[matchidxs][cust_matched]
        }

        # apply new levels to sourcefctr and unname
        destination_vector <- unname(matches[as.numeric(sourcefctr)])

    } else { # non-regex codes

        # sanity check
        if (is.character(origin_vector) && is.numeric(dictionary[[origin]])) {
            msg <- sprintf("To convert a `%s` code, `sourcevar` must be numeric.", origin)
            stop(msg, call. = FALSE)
        }

        dict <- stats::na.omit(dictionary[, c(origin, destination)])

        sourcefctr <- factor(origin_vector)

        # match levels of sourcefctr
        if (identical(origin, "cctld")) {
          matchidxs <- match(levels(sourcefctr), toupper(dict[[origin]]))
        } else {
          matchidxs <- match(levels(sourcefctr), dict[[origin]])
        }
        matches <- dict[[destination]][matchidxs]

        # replace with custom matches if set
        if (!is.null(custom_match)) {
          matchidxs <- match(levels(sourcefctr), names(custom_match))
          cust_matched <- !is.na(matchidxs)
          matches[cust_matched] <- custom_match[matchidxs][cust_matched]
        }

        # apply new levels to sourcefctr
        destination_vector <- matches[as.numeric(sourcefctr)]
    }

    # Filling-in failed matches
    sane_sourcevar <- class(sourcevar)[1] == class(destination_vector)[1]
    sane_nomatch <- class(nomatch)[1] == class(destination_vector)[1]
    idx <- is.na(destination_vector)
    if (is.null(nomatch)) {
        if (sane_sourcevar) {
            destination_vector[idx] <- sourcevar[idx]
        } else if (class(sourcevar)[1] == "factor" & class(destination_vector)[1] == "character") {
            destination_vector[idx] <- as.character(sourcevar[idx])
        } else {
            warning("The origin and destination codes are not of the same
                    class. Filling-in bad matches with NA instead.", call. = FALSE)
        }
    } else if ((length(nomatch) == 1) && is.na(nomatch)) { # NA
    } else if ((length(nomatch) == 1) && sane_nomatch) { # single replacement
        destination_vector[idx] <- nomatch
    } else if ((length(nomatch) == length(sourcevar)) & sane_sourcevar) { # vector replacement
        destination_vector[idx] <- nomatch[idx]
    } else {
        warning("The argument `nomatch` must be NULL, NA, or of the same class
                as the destination vector. Filling-in bad matches with NA instead.", call. = FALSE)
    }

    # Warnings
    if(warn){
        badmatch <- sort(unique(origin_vector[is.na(destination_vector)]))
        badmatch <- badmatch[!badmatch %in% names(custom_match)]  # do not report <NA>'s that were set explicitly by custom_match
        if(length(badmatch) > 0){
            warning("Some values were not matched unambiguously: ", paste(badmatch, collapse=", "),
                    "\nTo fix unmatched values, please use the `custom_match` argument. ",
                    "If you think the default matching rules should be improved, please file an issue at ",
                    "https://github.com/vincentarelbundock/countrycode/issues\n", call. = FALSE)
        }
        if(origin_regex){
           if(length(destination_list) > 0){
               if (!is.null(custom_match)) {
                   destination_list <- destination_list[!names(destination_list) %in% names(custom_match)]
               }
               if (length(destination_list) > 0) {
                   destination_list <- lapply(destination_list, function(k) paste(k, collapse=','))
                   destination_list <- sort(unique(do.call('c', destination_list)))
                   warning("Some strings were matched more than once, and therefore set to <NA> in the result: ", paste(destination_list, collapse="; "), "\n", call. = FALSE)
               }
           }
        }
    }
    return(destination_vector)
}


================================================
FILE: R/countryname.R
================================================
#' Convert country names in any language to another name or code
#'
#' Converts long country names in any language to one of many different country
#' code schemes or country names. `countryname` does 2 passes on the data.
#' First, it tries to detect variations of country names in many languages
#' extracted from the Unicode Common Locale Data Repository. Second, it applies
#' `countrycode`'s English regexes to try to match the remaining cases. Because
#' it does two passes, `countryname` can sometimes produce ambiguous results,
#' e.g., Saint Martin vs. Saint Martin (French Part). Users who need a "safer"
#' option can use: `countrycode(x, "country.name", "country.name")` Note that
#' the function works with non-ASCII characters. Please see the Github page for
#' examples.
#'
#' @param sourcevar Vector which contains the codes or country names to be
#' converted (character or factor)
#' @param destination Coding scheme of destination (string such as "iso3c"
#' enclosed in quotes ""): type `?codelist` for a list of
#' available codes.
#' @param warn Prints unique elements from sourcevar for which no match was found
#' @inheritParams countrycode
#' @export
#' @aliases countryname
#' @examples
#' \dontrun{
#' x <- c('Afaganisitani', 'Barbadas', 'Sverige', 'UK')
#' countryname(x)
#' countryname(x, destination = 'iso3c')
#' }
#'
countryname <- function(sourcevar, destination = 'country.name.en', nomatch = NA, warn = TRUE) {
    
    out <- countrycode(sourcevar = sourcevar,
                       origin = 'country.name.alt',
                       destination = 'country.name.en',
                       custom_dict = countrycode::countryname_dict,
                       warn = FALSE)
    
    idx <- is.na(out)
    out[idx] <- countrycode(sourcevar = sourcevar[idx], 
                            origin = 'country.name.en', 
                            destination = 'country.name.en', 
                            nomatch = nomatch,
                            warn = warn)
    
    if (destination != 'country.name.en') {
      # Issue 309: in the second pass we can use the origin vector for NAs, but only if origin and destination are of the same type and origin is a country name, not a code.
      out <- countrycode(sourcevar = out,
                         origin = 'country.name.en', 
                         destination = destination,
                        #  custom_dict = countrycode::codelist, 
                         nomatch = nomatch,
                         warn = warn)
    }
    
    return(out)
}



================================================
FILE: R/countryname_dict.R
================================================
#' A dataframe of alternative country names in many languages. Used internally by
#' the `countryname` function.
#'
#' @docType data
#' @keywords datasets
#' @name countryname_dict
#' @format dataframe
NULL


================================================
FILE: R/get_dictionary.R
================================================
#' Get Custom Dictionaries
#' 
#' Download a custom dictionary to use in the `custom_dict` argument of `countrycode()`
#'
#' @param dictionary A character string that specifies the dictionary to be
#' retrieved. It must be one of "global_burden_of_disease", "ch_cantons",
#' "us_states", "exiobase3", "gtap10". If NULL, the function will print the list
#' of available dictionaries. Default is NULL.
#'
#' @return If a valid dictionary is specified, the function will return that dictionary as a data.frame.
#' If an invalid dictionary or no dictionary is specified, the function will stop and throw an error message.
#'
#' @examples
#' \dontrun{
#' cd <- get_dictionary("us_states")
#' countrycode::countrycode(c("MO", "MN"), origin = "state.abb", "state.name", custom_dict = cd)
#' }
#' @export
get_dictionary <- function(dictionary = NULL) {
    valid <- sort(c("global_burden_of_disease", "ch_cantons", "us_states", "exiobase3", "gtap10"))
    if (is.null(dictionary)) {
        message(sprintf("Available dictionaries: %s", paste(valid, collapse = ", ")))
        return(invisible(NULL))
    }
    if (isTRUE(is.character(dictionary) && length(dictionary) == 1 && dictionary %in% valid)) {
        url <- sprintf("https://github.com/vincentarelbundock/countrycode/raw/main/data/custom_dictionaries/data_%s.rds", dictionary)
        tmp <- tempfile()
        utils::download.file(url, tmp)
        out <- readRDS(tmp)
        unlink(tmp)
        return(out)
    } else {
        stop("dictionary must be a character vector of length 1 and one of: ", paste(valid, collapse = ", "))
    }
}


================================================
FILE: R/guess_field.R
================================================
#' Guess the code/name of a vector
#'
#' Users sometimes do not know what kind of code or field their data contain.
#' This function tries to guess by comparing the similarity between a
#' user-supplied vector and all the codes included in the `countrycode`
#' dictionary.
#'
#' @param codes a vector of country codes or country names
#' @param min_similarity the function returns all field names where over than
#' `min_similarity`% of codes are shared between the supplied vector and the
#' `countrycode` dictionary.
#'
#' @export
#' @examples
#' # Guess ISO codes
#' guess_field(c('DZA', 'CAN', 'DEU'))
#'
#' # Guess country names
#' guess_field(c('Guinea','Iran','Russia','North Korea',rep('Ivory Coast',50),'Scotland'))
guess_field <- function(codes, min_similarity = 80) {
  if (!mode(codes) %in% c('character', 'numeric')) {
    stop('sourcevar must be a character or numeric vector. This error often arises when users pass a tibble (e.g., from dplyr) instead of a column vector from a data.frame (i.e., my_tbl[, 2] vs. my_df[, 2] vs. my_tbl[[2]]). This can also happen when `sourcevar` is entirely composed of `NA`, which `R` treats as entries of class logical.')
  }

  x <- unique(codes)

  match_percentage <-
    sapply(countrycode::codelist, function(code) {
      sum(x %in% code) / length(x) * 100
    })

  match_percentage <- match_percentage[match_percentage >= min_similarity]

  match_percentage <- match_percentage[order(match_percentage, decreasing = TRUE)]

  data.frame(code = names(match_percentage),
             percent_of_unique_matched = match_percentage,
             stringsAsFactors = FALSE)
}


================================================
FILE: README.Rmd
================================================
---
output: github_document
---

<p align="center">
<img src="https://user-images.githubusercontent.com/987058/167296405-e7798ac8-03e7-444e-acaf-d99fc42d1c9e.png" align="right" alt="" width="125" />
</p>
<br>

<!-- badges: start -->
[![DOI](http://joss.theoj.org/papers/10.21105/joss.00848/status.svg)](https://doi.org/10.21105/joss.00848)
<a href = "https://vincentarelbundock.github.io/countrycode" target = "_blank"><img src="https://img.shields.io/static/v1?label=Website&message=Visit&color=blue"></a>
[![R build status](https://github.com/vincentarelbundock/countrycode/workflows/R-CMD-check/badge.svg)](https://github.com/vincentarelbundock/countrycode/actions)
<a href = "https://vincentarelbundock.github.io/countrycode" target = "_blank"><img src="http://cranlogs.r-pkg.org/badges/grand-total/countrycode"></a>
<!-- badges: end -->

`countrycode` standardizes country names, converts them into ~40 different coding schemes, and assigns region descriptors. Scroll down for more details or visit the [countrycode CRAN page](http://cran.r-project.org/web/packages/countrycode/index.html)

If you use `countrycode` in your research, we would be very grateful if you could cite our paper:

> Arel-Bundock, Vincent, Nils Enevoldsen, and CJ Yetman, (2018). countrycode: An R package to convert country names and country codes. Journal of Open Source Software, 3(28), 848, https://doi.org/10.21105/joss.00848

## Why `countrycode`?

### The Problem

Different data sources use different coding schemes to represent countries (e.g. CoW or ISO). This poses two main problems: (1) some of these coding schemes are less than intuitive, and (2) merging these data requires converting from one coding scheme to another, or from long country names to a coding scheme.

### The Solution

The `countrycode` function can convert to and from 40+ different country coding schemes, and to 600+ variants of country names in different languages and formats. It uses regular expressions to convert long country names (e.g. Sri Lanka) into any of those coding schemes or country names. It can create new variables with various regional groupings.

## Installation

From the R console, type: 

```r
install.packages("countrycode")
```

To install the latest development version, you can use the `remotes` package:

```r
library(remotes)
install_github('vincentarelbundock/countrycode')
```

## Supported codes

To get an up-to-date list of supported country codes, install the package and type `?codelist`. These include:

* 600+ variants of country names in different languages and formats.
* Telephone
* AR5
* Continent and region identifiers.
* Correlates of War (numeric and character)
* European Central Bank
* [EUROCONTROL](https://www.eurocontrol.int) - The European Organisation for the Safety of Air Navigation
* Eurostat
* Federal Information Processing Standard (FIPS)
* Food and Agriculture Organization of the United Nations
* Global Administrative Unit Layers (GAUL)
* Geopolitical Entities, Names and Codes (GENC)
* Gleditsch & Ward (numeric and character)
* International Civil Aviation Organization
* International Monetary Fund
* International Olympic Committee
* ISO (2/3-character and numeric)
* Polity IV
* United Nations
* United Nations Procurement Division
* Varieties of Democracy
* World Bank
* World Values Survey
* Unicode symbols (flags)



================================================
FILE: README.md
================================================

<p align="center">

<img src="https://user-images.githubusercontent.com/987058/167296405-e7798ac8-03e7-444e-acaf-d99fc42d1c9e.png" align="right" alt="" width="125" />
</p>

<br>

<!-- badges: start -->

[![DOI](http://joss.theoj.org/papers/10.21105/joss.00848/status.svg)](https://doi.org/10.21105/joss.00848)
<a href = "https://vincentarelbundock.github.io/countrycode" target = "_blank"><img src="https://img.shields.io/static/v1?label=Website&message=Visit&color=blue"></a>
[![R build
status](https://github.com/vincentarelbundock/countrycode/workflows/R-CMD-check/badge.svg)](https://github.com/vincentarelbundock/countrycode/actions)
<a href = "https://vincentarelbundock.github.io/countrycode" target = "_blank"><img src="http://cranlogs.r-pkg.org/badges/grand-total/countrycode"></a>
<!-- badges: end -->

`countrycode` standardizes country names, converts them into ~40
different coding schemes, and assigns region descriptors. Scroll down
for more details or visit the [countrycode CRAN
page](http://cran.r-project.org/web/packages/countrycode/index.html)

If you use `countrycode` in your research, we would be very grateful if
you could cite our paper:

> Arel-Bundock, Vincent, Nils Enevoldsen, and CJ Yetman, (2018).
> countrycode: An R package to convert country names and country codes.
> Journal of Open Source Software, 3(28), 848,
> <https://doi.org/10.21105/joss.00848>

## Why `countrycode`?

### The Problem

Different data sources use different coding schemes to represent
countries (e.g. CoW or ISO). This poses two main problems: (1) some of
these coding schemes are less than intuitive, and (2) merging these data
requires converting from one coding scheme to another, or from long
country names to a coding scheme.

### The Solution

The `countrycode` function can convert to and from 40+ different country
coding schemes, and to 600+ variants of country names in different
languages and formats. It uses regular expressions to convert long
country names (e.g. Sri Lanka) into any of those coding schemes or
country names. It can create new variables with various regional
groupings.

## Installation

From the R console, type:

``` r
install.packages("countrycode")
```

To install the latest development version, you can use the `remotes`
package:

``` r
library(remotes)
install_github('vincentarelbundock/countrycode')
```

## Supported codes

To get an up-to-date list of supported country codes, install the
package and type `?codelist`. These include:

- 600+ variants of country names in different languages and formats.
- Telephone
- AR5
- Continent and region identifiers.
- Correlates of War (numeric and character)
- European Central Bank
- [EUROCONTROL](https://www.eurocontrol.int) - The European Organisation
  for the Safety of Air Navigation
- Eurostat
- Federal Information Processing Standard (FIPS)
- Food and Agriculture Organization of the United Nations
- Global Administrative Unit Layers (GAUL)
- Geopolitical Entities, Names and Codes (GENC)
- Gleditsch & Ward (numeric and character)
- International Civil Aviation Organization
- International Monetary Fund
- International Olympic Committee
- ISO (2/3-character and numeric)
- Polity IV
- United Nations
- United Nations Procurement Division
- Varieties of Democracy
- World Bank
- World Values Survey
- Unicode symbols (flags)


================================================
FILE: _pkgdown.yml
================================================
template:
  params:
    bootswatch: readable


================================================
FILE: altdoc/.nojekyll
================================================


================================================
FILE: altdoc/docsify.html
================================================
<!-- index.html -->

<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width,initial-scale=1">
  <meta charset="UTF-8">
  <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@4/themes/vue.css" />
</head>
<body>
  <div id="app"></div>
  <script>
    window.$docsify = {
      name: '$ALTDOC_PACKAGE_NAME',
      repo: '$ALTDOC_PACKAGE_URL_GITHUB',
      loadSidebar: true,
      subMaxLevel: 2,
      search: {
        placeholder: 'Search',
        depth: 3,
      },
      auto2top: true,
      copyCode: {
        buttonText : 'Copy',
        errorText  : 'Error',
        successText: 'Copied'
      },
      plugins: [
        function(hook) {
          var footer = ["<a href='$ALTDOC_PACKAGE_URL'> <code> $ALTDOC_PACKAGE_NAME </code> v. $ALTDOC_PACKAGE_VERSION </a> | Documentation made with <a href='https://altdoc.etiennebacher.com/'> <code> altdoc </code> v. $ALTDOC_VERSION</a>"].join('');

          hook.afterEach(function(html) {
            return html + footer;
          });
        }
      ]
    }
  </script>
  <script src="//cdn.jsdelivr.net/npm/docsify@4"></script>
  <script src="//cdn.jsdelivr.net/npm/docsify-copy-code"></script>
  <script src="//cdn.jsdelivr.net/npm/prismjs@1.24.1/components/prism-r.js"></script>
  <script src="//unpkg.com/docsify/lib/plugins/search.min.js"></script>
</body>
</html>


================================================
FILE: altdoc/docsify.md
================================================
* [Home](/)
* Articles: $ALTDOC_VIGNETTE_BLOCK
* Reference: $ALTDOC_MAN_BLOCK
* [News]($ALTDOC_NEWS)
* [Changelog]($ALTDOC_CHANGELOG)
* [Code of Conduct]($ALTDOC_CODE_OF_CONDUCT)
* [License]($ALTDOC_LICENSE)
* [Licence]($ALTDOC_LICENCE)
* [Citation]($ALTDOC_CITATION)


================================================
FILE: altdoc/preamble_man_qmd.yml
================================================
---
format:
  md:
    prefer-html: true
---



================================================
FILE: altdoc/preamble_vignettes_qmd.yml
================================================
---
format:
  md:
    prefer_html: true
default-image-extension: ""
---


================================================
FILE: altdoc/preamble_vignettes_rmd.yml
================================================
---
always_allow_html: yes
---



================================================
FILE: appveyor.yml
================================================
# DO NOT CHANGE the "init" and "install" sections below

# Download script file from GitHub
init:
  ps: |
        $ErrorActionPreference = "Stop"
        Invoke-WebRequest http://raw.github.com/krlmlr/r-appveyor/master/scripts/appveyor-tool.ps1 -OutFile "..\appveyor-tool.ps1"
        Import-Module '..\appveyor-tool.ps1'

install:
  ps: Bootstrap

cache:
  - C:\RLibrary

environment:
  NOT_CRAN: true
  # env vars that may need to be set, at least temporarily, from time to time
  # see https://github.com/krlmlr/r-appveyor#readme for details
  # USE_RTOOLS: true
  # R_REMOTES_STANDALONE: true

# Adapt as necessary starting from here

build_script:
  - travis-tool.sh install_deps

test_script:
  - travis-tool.sh run_tests

on_failure:
  - 7z a failure.zip *.Rcheck\*
  - appveyor PushArtifact failure.zip

artifacts:
  - path: '*.Rcheck\**\*.log'
    name: Logs

  - path: '*.Rcheck\**\*.out'
    name: Logs

  - path: '*.Rcheck\**\*.fail'
    name: Logs

  - path: '*.Rcheck\**\*.Rout'
    name: Logs

  - path: '\*_*.tar.gz'
    name: Bits

  - path: '\*_*.zip'
    name: Bits


================================================
FILE: countrycode.Rproj
================================================
Version: 1.0

RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default

EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8

RnwWeave: Sweave
LaTeX: pdfLaTeX

AutoAppendNewline: Yes
StripTrailingWhitespace: Yes

BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageRoxygenize: rd,collate,namespace


================================================
FILE: cran-comments.md
================================================


================================================
FILE: data/custom_dictionaries/data_ch_cantons.csv
================================================
fso.number,abbreviation,canton.name,canton.name.regex,canton.name.de,canton.name.fr,canton.name.it,canton.name.rm
1,ZH,Zürich,(Z|T)(u|ü)ri(ch|go|tg),Zürich,Zurich,Zurigo,Turitg
2,BE,Bern,Bern(e|a)?,Bern,Berne,Berna,Berna
3,LU,Luzern,Lu(z|c)ern(e|a)?,Luzern,Lucerne,Lucerna,Lucerna
4,UR,Uri,Uri,Uri,Uri,Uri,Uri
5,SZ,Schwyz,Schwyz|Svi(tto|z),Schwyz,Svitto,Svitto,Sviz
6,OW,Obwalden,Ob(w|v)ald((e|o)n?)?|Sursilvania,Obwalden,Obwald,Obvaldo,Sursilvania
7,NW,Nidwalden,Nid(w|v)ald((e|o)n?)?|Sutsilvania,Nidwalden,Nidwald,Nidvaldo,Sutsilvania
8,GL,Glarus,Glar(i|o|u)(s|na),Glarus,Glaris,Glarona,Glaruna
9,ZG,Zug,Z(u|ou)go?,Zug,Zoug,Zugo,Zug
10,FR,Fribourg,Fre?ib(ou|u)rgo?,Freiburg,Fribourg,Friburgo,Friburg
11,SO,Solothurn,Sol(oth?urn|eure|etta),Solothurn,Soleure,Soletta,Soloturn
12,BS,Basel-Stadt,B(a|â)(sel|silea|le)(\W|-)(Stadt|Ville|Cit+(a|à)d?),Basel-Stadt,Bâle-Ville,Basilea Città,Basilea-Citad
13,BL,Basel-Landschaft,B(a|â)(sel|silea|le)(\W|-)(Landschaft|Ch?ampagn(a|e)),Basel-Landschaft,Bâle-Campagne,Basilea Campagna,Basilea-Champagna
14,SH,Schaffhausen,Sc(h|i)affh?(a|o)?us(a|e)n?,Schaffhausen,Schaffhouse,Sciaffusa,Schaffusa
15,AR,Appenzell Ausserrhoden,Appenzello?\W(Ausserrhoden|Rhodes-Extérieures|Esterno|Dadora),Appenzell Ausserrhoden,Appenzell Rhodes-Extérieures,Appenzello Esterno,Appenzell Dadora
16,AI,Appenzell Innerrhoden,Appenzello?\W(Innerrhoden|Rhodes-Intérieures|Interno|Dadens),Appenzell Innerrhoden,Appenzell Rhodes-Intérieures,Appenzello Interno,Appenzell Dadens
17,SG,St. Gallen,(S(t|k)\.|Saint|Sankt|S(a|o)n)(\W|-)Ga(ll(en|o)?|gl),St. Gallen,Saint-Gall,San Gallo,Son Gagl
18,GR,Grischun,Gr(aubünden|isons|igioni|ischun),Graubünden,Grisons,Grigioni,Grischun
19,AG,Aargau,Aa?rg(au|ou)(ia|ie)?,Aargau,Argovie,Argovia,Argovia
20,TG,Thurgau,Th?urg(au|ov)(ia|ie)?,Thurgau,Thurgovie,Turgovia,Turgovia
21,TI,Ticino,T(essin|icino),Tessin,Tessin,Ticino,Tessin
22,VD,Vaud,Vau?d|Waadt,Waadt,Vaud,Vaud,Vad
23,VS,Valais,(V|W)al+(e|i|ai)se?,Wallis,Valais,Vallese,Vallais
24,NE,Neuchâtel,Neuchâtel|Neuenburg|Neocastello,Neuenburg,Neuchâtel,Neocastello,Neuchâtel
25,GE,Genève,Genf|G(e|i)n(e|è)vr?(a|e),Genf,Genève,Ginevra,Genevra
26,JU,Jura,(J|G)i?ura,Jura,Jura,Giura,Giura


================================================
FILE: data/custom_dictionaries/data_exiobase3.csv
================================================
country,exiobase_code,exiobase_num
Afghanistan,WA,45
Albania,WE,47
Algeria,WF,48
American Samoa,WA,45
Andorra,WE,47
Angola,WF,48
Anguilla,WL,46
Antarctica,WA,45
Antigua & Barbuda,WL,46
Argentina,WL,46
Armenia,WA,45
Aruba,WL,46
Australia,AU,38
Austria,AT,1
Azerbaijan,WA,45
Bahamas,WL,46
Bahrain,WM,49
Bangladesh,WA,45
Barbados,WL,46
Belarus,WE,47
Belgium,BE,2
Belize,WL,46
Benin,WF,48
Bermuda,WL,46
Bhutan,WA,45
Bolivia,WL,46
Caribbean Netherlands,WL,46
Bosnia & Herzegovina,WE,47
Botswana,WF,48
Bouvet Island,WA,45
Brazil,BR,34
British Indian Ocean Territory,WA,45
Brunei,WA,45
Bulgaria,BG,3
Burkina Faso,WF,48
Burundi,WF,48
Cambodia,WA,45
Cameroon,WF,48
Canada,CA,32
Cape Verde,WF,48
Cayman Islands,WL,46
Central African Republic,WF,48
Chad,WF,48
Channel Islands,WE,47
Chile,WL,46
China,CN,31
Christmas Island,WA,45
Cocos (Keeling) Islands,WA,45
Colombia,WL,46
Comoros,WF,48
Congo - Kinshasa,WF,48
Congo - Brazzaville,WF,48
Cook Islands,WA,45
Costa Rica,WL,46
Côte d’Ivoire,WF,48
Croatia,HR,13
Cuba,WL,46
Curaçao,WL,46
Cyprus,CY,4
Czechia,CZ,5
Denmark,DK,7
Djibouti,WF,48
Dominica,WL,46
Dominican Republic,WL,46
Ecuador,WL,46
Egypt,WM,49
El Salvador,WL,46
Equatorial Guinea,WF,48
Eritrea,WF,48
Estonia,EE,8
Ethiopia,WF,48
Faroe Islands,WE,47
Falkland Islands,WL,46
Fiji,WA,45
Finland,FI,10
France,FR,11
French Guiana,WL,46
French Polynesia,WA,45
Gabon,WF,48
Gambia,WF,48
Georgia,WA,45
Germany,DE,6
Ghana,WF,48
Gibraltar,WE,47
Greece,GR,12
Greenland,WL,46
Grenada,WL,46
Guadeloupe,WL,46
Guam,WA,45
Guatemala,WL,46
Guinea,WF,48
Guinea-Bissau,WF,48
Guyana,WL,46
Haiti,WL,46
Heard & McDonald Islands,WA,45
Honduras,WL,46
Hong Kong SAR China,WA,45
Hungary,HU,14
Iceland,WE,47
India,IN,35
Indonesia,ID,43
Iran,WM,49
Iraq,WM,49
Ireland,IE,15
Isle of Man,WE,47
Israel,WM,49
Italy,IT,16
Jamaica,WL,46
Japan,JP,30
Jordan,WM,49
Kazakhstan,WA,45
Kenya,WF,48
Kiribati,WA,45
North Korea,WA,45
Kosovo,WE,47
Kuwait,WM,49
Kyrgyzstan,WA,45
Laos,WA,45
Latvia,LV,19
Lebanon,WM,49
Lesotho,WF,48
Liberia,WF,48
Libya,WF,48
Liechtenstein,WE,47
Lithuania,LT,17
Luxembourg,LU,18
Macao SAR China,WA,45
North Macedonia,WE,47
Madagascar,WF,48
Malawi,WF,48
Malaysia,WA,45
Maldives,WA,45
Mali,WF,48
Malta,MT,20
Marshall Islands,WA,45
Martinique,WL,46
Mauritania,WF,48
Mauritius,WF,48
Mayotte,WF,48
Mexico,MX,36
Micronesia (Federated States of),WA,45
Moldova,WE,47
Monaco,WE,47
Mongolia,WA,45
Montenegro,WE,47
Montserrat,WL,46
Morocco,WF,48
Mozambique,WF,48
Myanmar (Burma),WA,45
Namibia,WF,48
Nauru,WA,45
Nepal,WA,45
Netherlands,NL,21
Netherlands Antilles,WL,46
New Caledonia,WA,45
New Zealand,WA,45
Nicaragua,WL,46
Niger,WF,48
Nigeria,WF,48
Niue,WA,45
Norfolk Island,WA,45
Northern Mariana Islands,WA,45
Norway,NO,42
Oman,WM,49
Pakistan,WA,45
Palau,WA,45
Palestinian Territories,WM,49
Panama,WL,46
Papua New Guinea,WA,45
Paraguay,WL,46
Peru,WL,46
Philippines,WA,45
Pitcairn Islands,WA,45
Poland,PL,22
Portugal,PT,23
Puerto Rico,WL,46
Qatar,WM,49
Réunion,WF,48
Romania,RO,24
Russia,RU,37
Rwanda,WF,48
Samoa,WA,45
San Marino,WE,47
São Tomé & Príncipe,WF,48
Saudi Arabia,WM,49
Senegal,WF,48
Serbia,WE,47
Seychelles,WF,48
Sierra Leone,WF,48
Singapore,WA,45
Sint Maarten,WL,46
Slovakia,SK,27
Slovenia,SI,26
Solomon Islands,WA,45
Somalia,WF,48
South Africa,ZA,44
South Georgia & South Sandwich Islands,WA,45
South Korea,KR,33
South Sudan,WF,48
Spain,ES,9
Sri Lanka,WA,45
St. Helena,WF,48
St. Kitts & Nevis,WL,46
St. Lucia,WL,46
St. Pierre & Miquelon,WL,46
St. Vincent & Grenadines,WL,46
Sudan,WF,48
Suriname,WL,46
Svalbard & Jan Mayen,WE,47
Eswatini,WF,48
Sweden,SE,25
Switzerland,CH,39
Syria,WM,49
Taiwan,TW,41
Tajikistan,WA,45
Tanzania,WF,48
Thailand,WA,45
Timor-Leste,WA,45
Togo,WF,48
Tokelau,WA,45
Tonga,WA,45
Trinidad & Tobago,WL,46
Tunisia,WF,48
Turkey,TR,40
Turkmenistan,WA,45
Turks & Caicos Islands,WL,46
Tuvalu,WA,45
Uganda,WF,48
Ukraine,WE,47
United Arab Emirates,WM,49
United Kingdom,GB,28
United States,US,29
United States Minor Outlying Islands (the),WA,45
Uruguay,WL,46
Uzbekistan,WA,45
Vanuatu,WA,45
Vatican City,WE,47
Venezuela,WL,46
Vietnam,WA,45
British Virgin Islands,WL,46
U.S. Virgin Islands,WL,46
Wallis & Futuna,WA,45
Western Sahara,WF,48
Yemen,WM,49
Zambia,WF,48
Zanzibar,WF,48
Zimbabwe,WF,48


================================================
FILE: data/custom_dictionaries/data_global_burden_of_disease.csv
================================================
iso3c,country.name,gbd_region,gbd_superregion
CHN,China,East Asia,"Southeast Asia, East Asia, and Oceania"
PRK,North Korea,East Asia,"Southeast Asia, East Asia, and Oceania"
TWN,Taiwan,East Asia,"Southeast Asia, East Asia, and Oceania"
KHM,Cambodia,Southeast Asia,"Southeast Asia, East Asia, and Oceania"
IDN,Indonesia,Southeast Asia,"Southeast Asia, East Asia, and Oceania"
LAO,Laos,Southeast Asia,"Southeast Asia, East Asia, and Oceania"
MYS,Malaysia,Southeast Asia,"Southeast Asia, East Asia, and Oceania"
MDV,Maldives,Southeast Asia,"Southeast Asia, East Asia, and Oceania"
MUS,Mauritius,Southeast Asia,"Southeast Asia, East Asia, and Oceania"
MMR,Myanmar,Southeast Asia,"Southeast Asia, East Asia, and Oceania"
PHL,Philippines,Southeast Asia,"Southeast Asia, East Asia, and Oceania"
LKA,Sri Lanka,Southeast Asia,"Southeast Asia, East Asia, and Oceania"
SYC,Seychelles,Southeast Asia,"Southeast Asia, East Asia, and Oceania"
THA,Thailand,Southeast Asia,"Southeast Asia, East Asia, and Oceania"
TLS,Timor-Leste,Southeast Asia,"Southeast Asia, East Asia, and Oceania"
VNM,Vietnam,Southeast Asia,"Southeast Asia, East Asia, and Oceania"
ASM,American Samoa,Oceania,"Southeast Asia, East Asia, and Oceania"
FSM,Federated States of Micronesia,Oceania,"Southeast Asia, East Asia, and Oceania"
FJI,Fiji,Oceania,"Southeast Asia, East Asia, and Oceania"
GUM,Guam,Oceania,"Southeast Asia, East Asia, and Oceania"
KIR,Kiribati,Oceania,"Southeast Asia, East Asia, and Oceania"
MHL,Marshall Islands,Oceania,"Southeast Asia, East Asia, and Oceania"
MNP,Northern Mariana Islands,Oceania,"Southeast Asia, East Asia, and Oceania"
PNG,Papua New Guinea,Oceania,"Southeast Asia, East Asia, and Oceania"
WSM,Samoa,Oceania,"Southeast Asia, East Asia, and Oceania"
SLB,Solomon Islands,Oceania,"Southeast Asia, East Asia, and Oceania"
TON,Tonga,Oceania,"Southeast Asia, East Asia, and Oceania"
VUT,Vanuatu,Oceania,"Southeast Asia, East Asia, and Oceania"
ARM,Armenia,Central Asia,"Central Europe, Eastern Europe, and Central Asia"
AZE,Azerbaijan,Central Asia,"Central Europe, Eastern Europe, and Central Asia"
GEO,Georgia,Central Asia,"Central Europe, Eastern Europe, and Central Asia"
KAZ,Kazakhstan,Central Asia,"Central Europe, Eastern Europe, and Central Asia"
KGZ,Kyrgyzstan,Central Asia,"Central Europe, Eastern Europe, and Central Asia"
MNG,Mongolia,Central Asia,"Central Europe, Eastern Europe, and Central Asia"
TJK,Tajikistan,Central Asia,"Central Europe, Eastern Europe, and Central Asia"
TKM,Turkmenistan,Central Asia,"Central Europe, Eastern Europe, and Central Asia"
UZB,Uzbekistan,Central Asia,"Central Europe, Eastern Europe, and Central Asia"
ALB,Albania,Central Europe,"Central Europe, Eastern Europe, and Central Asia"
BIH,Bosnia and Herzegovina,Central Europe,"Central Europe, Eastern Europe, and Central Asia"
BGR,Bulgaria,Central Europe,"Central Europe, Eastern Europe, and Central Asia"
HRV,Croatia,Central Europe,"Central Europe, Eastern Europe, and Central Asia"
CZE,Czech Republic,Central Europe,"Central Europe, Eastern Europe, and Central Asia"
HUN,Hungary,Central Europe,"Central Europe, Eastern Europe, and Central Asia"
MKD,Macedonia,Central Europe,"Central Europe, Eastern Europe, and Central Asia"
MNE,Montenegro,Central Europe,"Central Europe, Eastern Europe, and Central Asia"
POL,Poland,Central Europe,"Central Europe, Eastern Europe, and Central Asia"
ROU,Romania,Central Europe,"Central Europe, Eastern Europe, and Central Asia"
SRB,Serbia,Central Europe,"Central Europe, Eastern Europe, and Central Asia"
SVK,Slovakia,Central Europe,"Central Europe, Eastern Europe, and Central Asia"
SVN,Slovenia,Central Europe,"Central Europe, Eastern Europe, and Central Asia"
BLR,Belarus,Eastern Europe,"Central Europe, Eastern Europe, and Central Asia"
EST,Estonia,Eastern Europe,"Central Europe, Eastern Europe, and Central Asia"
LVA,Latvia,Eastern Europe,"Central Europe, Eastern Europe, and Central Asia"
LTU,Lithuania,Eastern Europe,"Central Europe, Eastern Europe, and Central Asia"
MDA,Moldova,Eastern Europe,"Central Europe, Eastern Europe, and Central Asia"
RUS,Russia,Eastern Europe,"Central Europe, Eastern Europe, and Central Asia"
UKR,Ukraine,Eastern Europe,"Central Europe, Eastern Europe, and Central Asia"
BRN,Brunei,High-income Asia Pacific,High-income
JPN,Japan,High-income Asia Pacific,High-income
KOR,South Korea,High-income Asia Pacific,High-income
SGP,Singapore,High-income Asia Pacific,High-income
AUS,Australia,Australasia,High-income
NZL,New Zealand,Australasia,High-income
AND,Andorra,Western Europe,High-income
AUT,Austria,Western Europe,High-income
BEL,Belgium,Western Europe,High-income
CYP,Cyprus,Western Europe,High-income
DNK,Denmark,Western Europe,High-income
FIN,Finland,Western Europe,High-income
FRA,France,Western Europe,High-income
DEU,Germany,Western Europe,High-income
GRC,Greece,Western Europe,High-income
ISL,Iceland,Western Europe,High-income
IRL,Ireland,Western Europe,High-income
ISR,Israel,Western Europe,High-income
ITA,Italy,Western Europe,High-income
LUX,Luxembourg,Western Europe,High-income
MLT,Malta,Western Europe,High-income
NLD,Netherlands,Western Europe,High-income
NOR,Norway,Western Europe,High-income
PRT,Portugal,Western Europe,High-income
ESP,Spain,Western Europe,High-income
SWE,Sweden,Western Europe,High-income
CHE,Switzerland,Western Europe,High-income
GBR,United Kingdom,Western Europe,High-income
ARG,Argentina,Southern Latin America,High-income
CHL,Chile,Southern Latin America,High-income
URY,Uruguay,Southern Latin America,High-income
CAN,Canada,High-income North America,High-income
GRL,Greenland,High-income North America,High-income
USA,United States,High-income North America,High-income
ATG,Antigua and Barbuda,Caribbean,Latin America and Caribbean
BHS,The Bahamas,Caribbean,Latin America and Caribbean
BRB,Barbados,Caribbean,Latin America and Caribbean
BLZ,Belize,Caribbean,Latin America and Caribbean
BMU,Bermuda,Caribbean,Latin America and Caribbean
CUB,Cuba,Caribbean,Latin America and Caribbean
DMA,Dominica,Caribbean,Latin America and Caribbean
DOM,Dominican Republic,Caribbean,Latin America and Caribbean
GRD,Grenada,Caribbean,Latin America and Caribbean
GUY,Guyana,Caribbean,Latin America and Caribbean
HTI,Haiti,Caribbean,Latin America and Caribbean
JAM,Jamaica,Caribbean,Latin America and Caribbean
PRI,Puerto Rico,Caribbean,Latin America and Caribbean
LCA,Saint Lucia,Caribbean,Latin America and Caribbean
VCT,Saint Vincent and the Grenadines,Caribbean,Latin America and Caribbean
SUR,Suriname,Caribbean,Latin America and Caribbean
TTO,Trinidad and Tobago,Caribbean,Latin America and Caribbean
VIR,"Virgin Islands, U.S.",Caribbean,Latin America and Caribbean
BOL,Bolivia,Andean Latin America,Latin America and Caribbean
ECU,Ecuador,Andean Latin America,Latin America and Caribbean
PER,Peru,Andean Latin America,Latin America and Caribbean
COL,Colombia,Central Latin America,Latin America and Caribbean
CRI,Costa Rica,Central Latin America,Latin America and Caribbean
SLV,El Salvador,Central Latin America,Latin America and Caribbean
GTM,Guatemala,Central Latin America,Latin America and Caribbean
HND,Honduras,Central Latin America,Latin America and Caribbean
MEX,Mexico,Central Latin America,Latin America and Caribbean
NIC,Nicaragua,Central Latin America,Latin America and Caribbean
PAN,Panama,Central Latin America,Latin America and Caribbean
VEN,Venezuela,Central Latin America,Latin America and Caribbean
BRA,Brazil,Tropical Latin America,Latin America and Caribbean
PRY,Paraguay,Tropical Latin America,Latin America and Caribbean
AFG,Afghanistan,North Africa and Middle East,North Africa and Middle East
DZA,Algeria,North Africa and Middle East,North Africa and Middle East
BHR,Bahrain,North Africa and Middle East,North Africa and Middle East
EGY,Egypt,North Africa and Middle East,North Africa and Middle East
IRN,Iran,North Africa and Middle East,North Africa and Middle East
IRQ,Iraq,North Africa and Middle East,North Africa and Middle East
JOR,Jordan,North Africa and Middle East,North Africa and Middle East
KWT,Kuwait,North Africa and Middle East,North Africa and Middle East
LBN,Lebanon,North Africa and Middle East,North Africa and Middle East
LBY,Libya,North Africa and Middle East,North Africa and Middle East
MAR,Morocco,North Africa and Middle East,North Africa and Middle East
PSE,Palestine,North Africa and Middle East,North Africa and Middle East
OMN,Oman,North Africa and Middle East,North Africa and Middle East
QAT,Qatar,North Africa and Middle East,North Africa and Middle East
SAU,Saudi Arabia,North Africa and Middle East,North Africa and Middle East
SDN,Sudan,North Africa and Middle East,North Africa and Middle East
SYR,Syria,North Africa and Middle East,North Africa and Middle East
TUN,Tunisia,North Africa and Middle East,North Africa and Middle East
TUR,Turkey,North Africa and Middle East,North Africa and Middle East
ARE,United Arab Emirates,North Africa and Middle East,North Africa and Middle East
YEM,Yemen,North Africa and Middle East,North Africa and Middle East
BGD,Bangladesh,South Asia,South Asia
BTN,Bhutan,South Asia,South Asia
IND,India,South Asia,South Asia
NPL,Nepal,South Asia,South Asia
PAK,Pakistan,South Asia,South Asia
AGO,Angola,Central Sub-Saharan Africa,Sub-Saharan Africa
CAF,Central African Republic,Central Sub-Saharan Africa,Sub-Saharan Africa
COG,Congo,Central Sub-Saharan Africa,Sub-Saharan Africa
COD,Democratic Republic of the Congo,Central Sub-Saharan Africa,Sub-Saharan Africa
GNQ,Equatorial Guinea,Central Sub-Saharan Africa,Sub-Saharan Africa
GAB,Gabon,Central Sub-Saharan Africa,Sub-Saharan Africa
BDI,Burundi,Eastern Sub-Saharan Africa,Sub-Saharan Africa
COM,Comoros,Eastern Sub-Saharan Africa,Sub-Saharan Africa
DJI,Djibouti,Eastern Sub-Saharan Africa,Sub-Saharan Africa
ERI,Eritrea,Eastern Sub-Saharan Africa,Sub-Saharan Africa
ETH,Ethiopia,Eastern Sub-Saharan Africa,Sub-Saharan Africa
KEN,Kenya,Eastern Sub-Saharan Africa,Sub-Saharan Africa
MDG,Madagascar,Eastern Sub-Saharan Africa,Sub-Saharan Africa
MWI,Malawi,Eastern Sub-Saharan Africa,Sub-Saharan Africa
MOZ,Mozambique,Eastern Sub-Saharan Africa,Sub-Saharan Africa
RWA,Rwanda,Eastern Sub-Saharan Africa,Sub-Saharan Africa
SOM,Somalia,Eastern Sub-Saharan Africa,Sub-Saharan Africa
SSD,South Sudan,Eastern Sub-Saharan Africa,Sub-Saharan Africa
TZA,Tanzania,Eastern Sub-Saharan Africa,Sub-Saharan Africa
UGA,Uganda,Eastern Sub-Saharan Africa,Sub-Saharan Africa
ZMB,Zambia,Eastern Sub-Saharan Africa,Sub-Saharan Africa
BWA,Botswana,Southern Sub-Saharan Africa,Sub-Saharan Africa
LSO,Lesotho,Southern Sub-Saharan Africa,Sub-Saharan Africa
NAM,Namibia,Southern Sub-Saharan Africa,Sub-Saharan Africa
ZAF,South Africa,Southern Sub-Saharan Africa,Sub-Saharan Africa
SWZ,Swaziland,Southern Sub-Saharan Africa,Sub-Saharan Africa
ZWE,Zimbabwe,Southern Sub-Saharan Africa,Sub-Saharan Africa
BEN,Benin,Western Sub-Saharan Africa,Sub-Saharan Africa
BFA,Burkina Faso,Western Sub-Saharan Africa,Sub-Saharan Africa
CMR,Cameroon,Western Sub-Saharan Africa,Sub-Saharan Africa
CPV,Cape Verde,Western Sub-Saharan Africa,Sub-Saharan Africa
TCD,Chad,Western Sub-Saharan Africa,Sub-Saharan Africa
CIV,Cote d'Ivoire,Western Sub-Saharan Africa,Sub-Saharan Africa
GMB,The Gambia,Western Sub-Saharan Africa,Sub-Saharan Africa
GHA,Ghana,Western Sub-Saharan Africa,Sub-Saharan Africa
GIN,Guinea,Western Sub-Saharan Africa,Sub-Saharan Africa
GNB,Guinea-Bissau,Western Sub-Saharan Africa,Sub-Saharan Africa
LBR,Liberia,Western Sub-Saharan Africa,Sub-Saharan Africa
MLI,Mali,Western Sub-Saharan Africa,Sub-Saharan Africa
MRT,Mauritania,Western Sub-Saharan Africa,Sub-Saharan Africa
NER,Niger,Western Sub-Saharan Africa,Sub-Saharan Africa
NGA,Nigeria,Western Sub-Saharan Africa,Sub-Saharan Africa
STP,Sao Tome and Principe,Western Sub-Saharan Africa,Sub-Saharan Africa
SEN,Senegal,Western Sub-Saharan Africa,Sub-Saharan Africa
SLE,Sierra Leone,Western Sub-Saharan Africa,Sub-Saharan Africa
TGO,Togo,Western Sub-Saharan Africa,Sub-Saharan Africa


================================================
FILE: data/custom_dictionaries/data_gtap10.csv
================================================
country,gtap_num,gtap_code,gtap_name
Australia,1,AUS,Australia
Christmas Island,1,AUS,Australia
Cocos (Keeling) Islands,1,AUS,Australia
Heard & McDonald Islands,1,AUS,Australia
Norfolk Island,1,AUS,Australia
New Zealand,2,NZL,New Zealand
American Samoa,3,XOC,Rest of Oceania
Cook Islands,3,XOC,Rest of Oceania
Fiji,3,XOC,Rest of Oceania
French Polynesia,3,XOC,Rest of Oceania
Guam,3,XOC,Rest of Oceania
Kiribati,3,XOC,Rest of Oceania
Marshall Islands,3,XOC,Rest of Oceania
Micronesia (Federated States of),3,XOC,Rest of Oceania
Nauru,3,XOC,Rest of Oceania
New Caledonia,3,XOC,Rest of Oceania
Niue,3,XOC,Rest of Oceania
Northern Mariana Islands,3,XOC,Rest of Oceania
Palau,3,XOC,Rest of Oceania
Papua New Guinea,3,XOC,Rest of Oceania
Pitcairn Islands,3,XOC,Rest of Oceania
Samoa,3,XOC,Rest of Oceania
Solomon Islands,3,XOC,Rest of Oceania
Tokelau,3,XOC,Rest of Oceania
Tonga,3,XOC,Rest of Oceania
Tuvalu,3,XOC,Rest of Oceania
United States Minor Outlying Islands (the),3,XOC,Rest of Oceania
Vanuatu,3,XOC,Rest of Oceania
Wallis & Futuna,3,XOC,Rest of Oceania
China,4,CHN,China
Hong Kong SAR China,5,HKG,"Hong Kong, Special Administrative Region of China"
Japan,6,JPN,Japan
South Korea,7,KOR,"Korea, Republic of"
Mongolia,8,MNG,Mongolia
Taiwan,9,TWN,Taiwan
North Korea,10,XEA,Rest of East Asia
Macao SAR China,10,XEA,Rest of East Asia
Brunei,11,BRN,Brunei Darussalam
Cambodia,12,KHM,Cambodia
Indonesia,13,IDN,Indonesia
Laos,14,LAO,Lao PDR
Malaysia,15,MYS,Malaysia
Philippines,16,PHL,Philippines
Singapore,17,SGP,Singapore
Thailand,18,THA,Thailand
Vietnam,19,VNM,Viet Nam
Myanmar (Burma),20,XSE,Rest of Southeast Asia
Timor-Leste,20,XSE,Rest of Southeast Asia
Bangladesh,21,BGD,Bangladesh
India,22,IND,India
Nepal,23,NPL,Nepal
Pakistan,24,PAK,Pakistan
Sri Lanka,25,LKA,Sri Lanka
Afghanistan,26,XSA,Rest of South Asia
Bhutan,26,XSA,Rest of South Asia
Maldives,26,XSA,Rest of South Asia
Canada,27,CAN,Canada
United States,28,USA,United States of America
Mexico,29,MEX,Mexico
Bermuda,30,XNA,Rest of North America
Greenland,30,XNA,Rest of North America
St. Pierre & Miquelon,30,XNA,Rest of North America
Argentina,31,ARG,Argentina
Bolivia,32,BOL,Bolivia
Brazil,33,BRA,Brazil
Chile,34,CHL,Chile
Colombia,35,COL,Colombia
Ecuador,36,ECU,Ecuador
Paraguay,37,PRY,Paraguay
Peru,38,PER,Peru
Uruguay,39,URY,Uruguay
Venezuela,40,VEN,Venezuela (Bolivarian Republic of)
Falkland Islands,41,XSM,Rest of South America
French Guiana,41,XSM,Rest of South America
Guyana,41,XSM,Rest of South America
South Georgia & South Sandwich Islands,41,XSM,Rest of South America
Suriname,41,XSM,Rest of South America
Costa Rica,42,CRI,Costa Rica
Guatemala,43,GTM,Guatemala
Honduras,44,HND,Honduras
Nicaragua,45,NIC,Nicaragua
Panama,46,PAN,Panama
El Salvador,47,SLV,El Salvador
Belize,48,XCA,Rest of Central America
Dominican Republic,49,DOM,Dominican Republic
Jamaica,50,JAM,Jamaica
Puerto Rico,51,PRI,Puerto Rico
Trinidad & Tobago,52,TTO,Trinidad and Tobago
Anguilla,53,XCB,Rest of Caribbean
Antigua & Barbuda,53,XCB,Rest of Caribbean
Aruba,53,XCB,Rest of Caribbean
Bahamas,53,XCB,Rest of Caribbean
Barbados,53,XCB,Rest of Caribbean
British Virgin Islands,53,XCB,Rest of Caribbean
Cayman Islands,53,XCB,Rest of Caribbean
Cuba,53,XCB,Rest of Caribbean
Dominica,53,XCB,Rest of Caribbean
Grenada,53,XCB,Rest of Caribbean
Haiti,53,XCB,Rest of Caribbean
Montserrat,53,XCB,Rest of Caribbean
Netherlands Antilles,53,XCB,Rest of Caribbean
St. Kitts & Nevis,53,XCB,Rest of Caribbean
St. Lucia,53,XCB,Rest of Caribbean
St. Vincent & Grenadines,53,XCB,Rest of Caribbean
Turks & Caicos Islands,53,XCB,Rest of Caribbean
U.S. Virgin Islands,53,XCB,Rest of Caribbean
Austria,54,AUT,Austria
Belgium,55,BEL,Belgium
Bulgaria,56,BGR,Bulgaria
Croatia,57,HRV,Croatia
Cyprus,58,CYP,Cyprus
Czechia,59,CZE,Czech Republic
Denmark,60,DNK,Denmark
Estonia,61,EST,Estonia
Finland,62,FIN,Finland
Åland Islands,62,FIN,Finland
France,63,FRA,France
Guadeloupe,63,FRA,France
Martinique,63,FRA,France
Réunion,63,FRA,France
Germany,64,DEU,Germany
Greece,65,GRC,Greece
Hungary,66,HUN,Hungary
Ireland,67,IRL,Ireland
Italy,68,ITA,Italy
Latvia,69,LVA,Latvia
Lithuania,70,LTU,Lithuania
Luxembourg,71,LUX,Luxembourg
Malta,72,MLT,Malta
Netherlands,73,NLD,Netherlands
Poland,74,POL,Poland
Portugal,75,PRT,Portugal
Romania,76,ROU,Romania
Slovakia,77,SVK,Slovakia
Slovenia,78,SVN,Slovenia
Spain,79,ESP,Spain
Sweden,80,SWE,Sweden
United Kingdom,81,GBR,United Kingdom
Switzerland,82,CHE,Switzerland
Norway,83,NOR,Norway
Svalbard & Jan Mayen,83,NOR,Norway
Iceland,84,XEF,Rest of European Free Trade Association
Liechtenstein,84,XEF,Rest of European Free Trade Association
Albania,85,ALB,Albania
Belarus,86,BLR,Belarus
Russia,87,RUS,Russian Federation
Ukraine,88,UKR,Ukraine
Moldova,89,XEE,Rest of Eastern Europe
Andorra,90,XER,Rest of Europe
Bosnia & Herzegovina,90,XER,Rest of Europe
Faroe Islands,90,XER,Rest of Europe
Gibraltar,90,XER,Rest of Europe
Guernsey,90,XER,Rest of Europe
Vatican City,90,XER,Rest of Europe
Isle of Man,90,XER,Rest of Europe
Jersey,90,XER,Rest of Europe
Monaco,90,XER,Rest of Europe
Montenegro,90,XER,Rest of Europe
North Macedonia,90,XER,Rest of Europe
San Marino,90,XER,Rest of Europe
Serbia,90,XER,Rest of Europe
Kazakhstan,91,KAZ,Kazakhstan
Kyrgyzstan,92,KGZ,Kyrgyzstan
Tajikistan,93,TJK,Tajikistan
Turkmenistan,94,XSU,Rest of Former Soviet Union
Uzbekistan,94,XSU,Rest of Former Soviet Union
Armenia,95,ARM,Armenia
Azerbaijan,96,AZE,Azerbaijan
Georgia,97,GEO,Georgia
Bahrain,98,BHR,Bahrain
Iran,99,IRN,"Iran, Islamic Republic of"
Israel,100,ISR,Israel
Jordan,101,JOR,Jordan
Kuwait,102,KWT,Kuwait
Oman,103,OMN,Oman
Qatar,104,QAT,Qatar
Saudi Arabia,105,SAU,Saudi Arabia
Turkey,106,TUR,Türkiye
United Arab Emirates,107,ARE,United Arab Emirates
Iraq,108,XWS,Rest of Western Asia
Lebanon,108,XWS,Rest of Western Asia
Palestinian Territories,108,XWS,Rest of Western Asia
Syria,108,XWS,Rest of Western Asia
Yemen,108,XWS,Rest of Western Asia
Egypt,109,EGY,Egypt
Morocco,110,MAR,Morocco
Tunisia,111,TUN,Tunisia
Algeria,112,XNF,Rest of North Africa
Libya,112,XNF,Rest of North Africa
Western Sahara,112,XNF,Rest of North Africa
Benin,113,BEN,Benin
Burkina Faso,114,BFA,Burkina Faso
Cameroon,115,CMR,Cameroon
Côte d’Ivoire,116,CIV,Côte d'Ivoire
Ghana,117,GHA,Ghana
Guinea,118,GIN,Guinea
Nigeria,119,NGA,Nigeria
Senegal,120,SEN,Senegal
Togo,121,TGO,Togo
Cape Verde,122,XWF,Rest of Western Africa
Gambia,122,XWF,Rest of Western Africa
Guinea-Bissau,122,XWF,Rest of Western Africa
Liberia,122,XWF,Rest of Western Africa
Mali,122,XWF,Rest of Western Africa
Mauritania,122,XWF,Rest of Western Africa
Niger,122,XWF,Rest of Western Africa
St. Helena,122,XWF,Rest of Western Africa
Sierra Leone,122,XWF,Rest of Western Africa
Central African Republic,123,XCF,Rest of Central Africa
Chad,123,XCF,Rest of Central Africa
Congo - Brazzaville,123,XCF,Rest of Central Africa
Equatorial Guinea,123,XCF,Rest of Central Africa
Gabon,123,XCF,Rest of Central Africa
São Tomé & Príncipe,123,XCF,Rest of Central Africa
Angola,124,XAC,South Central Africa
Congo - Kinshasa,124,XAC,South Central Africa
Ethiopia,125,ETH,Ethiopia
Kenya,126,KEN,Kenya
Madagascar,127,MDG,Madagascar
Malawi,128,MWI,Malawi
Mauritius,129,MUS,Mauritius
Mozambique,130,MOZ,Mozambique
Rwanda,131,RWA,Rwanda
Tanzania,132,TZA,"Tanzania, United Republic of"
Uganda,133,UGA,Uganda
Zambia,134,ZMB,Zambia
Zimbabwe,135,ZWE,Zimbabwe
Burundi,136,XEC,Rest of Eastern Africa
Comoros,136,XEC,Rest of Eastern Africa
Djibouti,136,XEC,Rest of Eastern Africa
Eritrea,136,XEC,Rest of Eastern Africa
Mayotte,136,XEC,Rest of Eastern Africa
Seychelles,136,XEC,Rest of Eastern Africa
Somalia,136,XEC,Rest of Eastern Africa
Sudan,136,XEC,Rest of Eastern Africa
Botswana,137,BWA,Botswana
Namibia,138,NAM,Namibia
South Africa,139,ZAF,South Africa
Eswatini,140,XSC,Rest of South African Customs Union
Lesotho,140,XSC,Rest of South African Customs Union
Antarctica,141,XTW,Rest of the World
Bouvet Island,141,XTW,Rest of the World
British Indian Ocean Territory,141,XTW,Rest of the World
French Southern Territories,141,XTW,Rest of the World


================================================
FILE: data/custom_dictionaries/data_gtap11.csv
================================================
country,gtap_num,gtap_code,gtap_name
Australia,1,AUS,Australia
Christmas Island,1,AUS,Australia
Cocos (Keeling) Islands,1,AUS,Australia
Heard & McDonald Islands,1,AUS,Australia
Norfolk Island,1,AUS,Australia
New Zealand,2,NZL,New Zealand
American Samoa,3,XOC,Rest of Oceania
Cook Islands,3,XOC,Rest of Oceania
Fiji,3,XOC,Rest of Oceania
French Polynesia,3,XOC,Rest of Oceania
Guam,3,XOC,Rest of Oceania
Kiribati,3,XOC,Rest of Oceania
Marshall Islands,3,XOC,Rest of Oceania
Micronesia (Federated States of),3,XOC,Rest of Oceania
Nauru,3,XOC,Rest of Oceania
New Caledonia,3,XOC,Rest of Oceania
Niue,3,XOC,Rest of Oceania
Northern Mariana Islands,3,XOC,Rest of Oceania
Palau,3,XOC,Rest of Oceania
Papua New Guinea,3,XOC,Rest of Oceania
Pitcairn Islands,3,XOC,Rest of Oceania
Samoa,3,XOC,Rest of Oceania
Solomon Islands,3,XOC,Rest of Oceania
Tokelau,3,XOC,Rest of Oceania
Tonga,3,XOC,Rest of Oceania
Tuvalu,3,XOC,Rest of Oceania
United States Minor Outlying Islands (the),3,XOC,Rest of Oceania
Vanuatu,3,XOC,Rest of Oceania
Wallis & Futuna,3,XOC,Rest of Oceania
China,4,CHN,China
Hong Kong SAR China,5,HKG,"Hong Kong, Special Administrative Region of China"
Japan,6,JPN,Japan
South Korea,7,KOR,"Korea, Republic of"
Mongolia,8,MNG,Mongolia
Taiwan,9,TWN,Taiwan
Macao SAR China,10,XEA,Rest of East Asia
North Korea,10,XEA,Rest of East Asia
Brunei,11,BRN,Brunei Darussalam
Cambodia,12,KHM,Cambodia
Indonesia,13,IDN,Indonesia
Laos,14,LAO,Lao PDR
Malaysia,15,MYS,Malaysia
Philippines,16,PHL,Philippines
Singapore,17,SGP,Singapore
Thailand,18,THA,Thailand
Vietnam,19,VNM,Viet Nam
Myanmar (Burma),20,XSE,Rest of Southeast Asia
Timor-Leste,20,XSE,Rest of Southeast Asia
Afghanistan,21,AFG,Afghanistan
Bangladesh,22,BGD,Bangladesh
India,23,IND,India
Nepal,24,NPL,Nepal
Pakistan,25,PAK,Pakistan
Sri Lanka,26,LKA,Sri Lanka
Bhutan,27,XSA,Rest of South Asia
Maldives,27,XSA,Rest of South Asia
Canada,28,CAN,Canada
United States,29,USA,United States of America
Mexico,30,MEX,Mexico
Bermuda,31,XNA,Rest of North America
Greenland,31,XNA,Rest of North America
St. Pierre & Miquelon,31,XNA,Rest of North America
Argentina,32,ARG,Argentina
Bolivia,33,BOL,Bolivia
Brazil,34,BRA,Brazil
Chile,35,CHL,Chile
Colombia,36,COL,Colombia
Ecuador,37,ECU,Ecuador
Paraguay,38,PRY,Paraguay
Peru,39,PER,Peru
Uruguay,40,URY,Uruguay
Venezuela,41,VEN,Venezuela (Bolivarian Republic of)
Falkland Islands,42,XSM,Rest of South America
French Guiana,42,XSM,Rest of South America
Guyana,42,XSM,Rest of South America
South Georgia & South Sandwich Islands,42,XSM,Rest of South America
Suriname,42,XSM,Rest of South America
Costa Rica,43,CRI,Costa Rica
Guatemala,44,GTM,Guatemala
Honduras,45,HND,Honduras
Nicaragua,46,NIC,Nicaragua
Panama,47,PAN,Panama
El Salvador,48,SLV,El Salvador
Belize,49,XCA,Rest of Central America
Dominican Republic,50,DOM,Dominican Republic
Haiti,51,HTI,Haiti
Jamaica,52,JAM,Jamaica
Puerto Rico,53,PRI,Puerto Rico
Trinidad & Tobago,54,TTO,Trinidad and Tobago
Anguilla,55,XCB,Rest of Caribbean
Antigua & Barbuda,55,XCB,Rest of Caribbean
Aruba,55,XCB,Rest of Caribbean
Bahamas,55,XCB,Rest of Caribbean
Barbados,55,XCB,Rest of Caribbean
Caribbean Netherlands,55,XCB,Rest of Caribbean
British Virgin Islands,55,XCB,Rest of Caribbean
Cayman Islands,55,XCB,Rest of Caribbean
Cuba,55,XCB,Rest of Caribbean
Curaçao,55,XCB,Rest of Caribbean
Dominica,55,XCB,Rest of Caribbean
Grenada,55,XCB,Rest of Caribbean
Montserrat,55,XCB,Rest of Caribbean
St. Barthélemy,55,XCB,Rest of Caribbean
St. Kitts & Nevis,55,XCB,Rest of Caribbean
St. Lucia,55,XCB,Rest of Caribbean
Saint Martin (French part),55,XCB,Rest of Caribbean
St. Vincent & Grenadines,55,XCB,Rest of Caribbean
Sint Maarten,55,XCB,Rest of Caribbean
Turks & Caicos Islands,55,XCB,Rest of Caribbean
U.S. Virgin Islands,55,XCB,Rest of Caribbean
Austria,56,AUT,Austria
Belgium,57,BEL,Belgium
Bulgaria,58,BGR,Bulgaria
Croatia,59,HRV,Croatia
Cyprus,60,CYP,Cyprus
Czechia,61,CZE,Czech Republic
Denmark,62,DNK,Denmark
Estonia,63,EST,Estonia
Finland,64,FIN,Finland
Åland Islands,64,FIN,Finland
France,65,FRA,France
Guadeloupe,65,FRA,France
Martinique,65,FRA,France
Réunion,65,FRA,France
Germany,66,DEU,Germany
Greece,67,GRC,Greece
Hungary,68,HUN,Hungary
Ireland,69,IRL,Ireland
Italy,70,ITA,Italy
Latvia,71,LVA,Latvia
Lithuania,72,LTU,Lithuania
Luxembourg,73,LUX,Luxembourg
Malta,74,MLT,Malta
Netherlands,75,NLD,Netherlands
Poland,76,POL,Poland
Portugal,77,PRT,Portugal
Romania,78,ROU,Romania
Slovakia,79,SVK,Slovakia
Slovenia,80,SVN,Slovenia
Spain,81,ESP,Spain
Sweden,82,SWE,Sweden
United Kingdom,83,GBR,United Kingdom
Switzerland,84,CHE,Switzerland
Norway,85,NOR,Norway
Svalbard & Jan Mayen,85,NOR,Norway
Iceland,86,XEF,Rest of European Free Trade Association
Liechtenstein,86,XEF,Rest of European Free Trade Association
Albania,87,ALB,Albania
Serbia,88,SRB,Serbia
Belarus,89,BLR,Belarus
Russia,90,RUS,Russian Federation
Ukraine,91,UKR,Ukraine
Moldova,92,XEE,Rest of Eastern Europe
Andorra,93,XER,Rest of Europe
Bosnia & Herzegovina,93,XER,Rest of Europe
Faroe Islands,93,XER,Rest of Europe
Gibraltar,93,XER,Rest of Europe
Guernsey,93,XER,Rest of Europe
Vatican City,93,XER,Rest of Europe
Isle of Man,93,XER,Rest of Europe
Jersey,93,XER,Rest of Europe
Kosovo,93,XER,Rest of Europe
Monaco,93,XER,Rest of Europe
Montenegro,93,XER,Rest of Europe
North Macedonia,93,XER,Rest of Europe
San Marino,93,XER,Rest of Europe
NA,93,XER,Rest of Europe
Kazakhstan,94,KAZ,Kazakhstan
Kyrgyzstan,95,KGZ,Kyrgyzstan
Tajikistan,96,TJK,Tajikistan
Uzbekistan,97,UZB,Uzbekistan
Turkmenistan,98,XSU,Rest of Former Soviet Union
Armenia,99,ARM,Armenia
Azerbaijan,100,AZE,Azerbaijan
Georgia,101,GEO,Georgia
Bahrain,102,BHR,Bahrain
Iran,103,IRN,"Iran, Islamic Republic of"
Iraq,104,IRQ,Iraq
Israel,105,ISR,Israel
Jordan,106,JOR,Jordan
Kuwait,107,KWT,Kuwait
Lebanon,108,LBN,Lebanon
Oman,109,OMN,Oman
Palestinian Territories,110,PSE,"Palestineian Territory, Occupied"
Qatar,111,QAT,Qatar
Saudi Arabia,112,SAU,Saudi Arabia
Syria,113,SYR,Syrian Arab Republic
Turkey,114,TUR,Turkey
United Arab Emirates,115,ARE,United Arab Emirates
Yemen,116,XWS,Rest of Western Asia
Algeria,117,DZA,Algeria
Egypt,118,EGY,Egypt
Morocco,119,MAR,Morocco
Tunisia,120,TUN,Tunisia
Libya,121,XNF,Rest of North Africa
Western Sahara,121,XNF,Rest of North Africa
Benin,122,BEN,Benin
Burkina Faso,123,BFA,Burkina Faso
Cameroon,124,CMR,Cameroon
Côte d’Ivoire,125,CIV,Côte d'Ivoire
Ghana,126,GHA,Ghana
Guinea,127,GIN,Guinea
Mali,128,MLI,Mali
Niger,129,NER,Niger
Nigeria,130,NGA,Nigeria
Senegal,131,SEN,Senegal
Togo,132,TGO,Togo
Cape Verde,133,XWF,Rest of Western Africa
Gambia,133,XWF,Rest of Western Africa
Guinea-Bissau,133,XWF,Rest of Western Africa
Liberia,133,XWF,Rest of Western Africa
Mauritania,133,XWF,Rest of Western Africa
St. Helena,133,XWF,Rest of Western Africa
Sierra Leone,133,XWF,Rest of Western Africa
Central African Republic,134,CAF,Central African Republic
Chad,135,TCD,Chad
Congo - Brazzaville,136,COG,Congo
Congo - Kinshasa,137,COD,Democratic Republic of the Congo
Equatorial Guinea,138,GNQ,Equatorial Guinea
Gabon,139,GAB,Gabon
Angola,140,XAC,Rest of South and Central Africa
São Tomé & Príncipe,140,XAC,Rest of South and Central Africa
Comoros,141,COM,Comoros
Ethiopia,142,ETH,Ethiopia
Kenya,143,KEN,Kenya
Madagascar,144,MDG,Madagascar
Malawi,145,MWI,Malawi
Mauritius,146,MUS,Mauritius
Mozambique,147,MOZ,Mozambique
Rwanda,148,RWA,Rwanda
Sudan,149,SDN,Sudan
Tanzania,150,TZA,"Tanzania, United Republic of"
Uganda,151,UGA,Uganda
Zambia,152,ZMB,Zambia
Zimbabwe,153,ZWE,Zimbabwe
Burundi,154,XEC,Rest of Eastern Africa
Djibouti,154,XEC,Rest of Eastern Africa
Eritrea,154,XEC,Rest of Eastern Africa
Mayotte,154,XEC,Rest of Eastern Africa
Seychelles,154,XEC,Rest of Eastern Africa
Somalia,154,XEC,Rest of Eastern Africa
South Sudan,154,XEC,Rest of Eastern Africa
Botswana,155,BWA,Botswana
Eswatini,156,SWZ,Eswatini
Namibia,157,NAM,Namibia
South Africa,158,ZAF,South Africa
Lesotho,159,XSC,Rest of South African Customs Union
Antarctica,160,XTW,Rest of the World
Bouvet Island,160,XTW,Rest of the World
British Indian Ocean Territory,160,XTW,Rest of the World
French Southern Territories,160,XTW,Rest of the World


================================================
FILE: data/custom_dictionaries/data_gtap6.csv
================================================
country,gtap_num,gtap_code,gtap_name
Australia,1,AUS,Australia
New Zealand,2,NZL,New Zealand
American Samoa,3,XOC,Rest of Oceania
Cook Islands,3,XOC,Rest of Oceania
Fiji,3,XOC,Rest of Oceania
French Polynesia,3,XOC,Rest of Oceania
Guam,3,XOC,Rest of Oceania
Kiribati,3,XOC,Rest of Oceania
Marshall Islands,3,XOC,Rest of Oceania
Micronesia (Federated States of),3,XOC,Rest of Oceania
Nauru,3,XOC,Rest of Oceania
New Caledonia,3,XOC,Rest of Oceania
Niue,3,XOC,Rest of Oceania
Norfolk Island,3,XOC,Rest of Oceania
Northern Mariana Islands,3,XOC,Rest of Oceania
Palau,3,XOC,Rest of Oceania
Papua New Guinea,3,XOC,Rest of Oceania
Samoa,3,XOC,Rest of Oceania
Solomon Islands,3,XOC,Rest of Oceania
Tokelau,3,XOC,Rest of Oceania
Tonga,3,XOC,Rest of Oceania
Tuvalu,3,XOC,Rest of Oceania
Vanuatu,3,XOC,Rest of Oceania
Wallis & Futuna,3,XOC,Rest of Oceania
China,4,CHN,China
Hong Kong SAR China,5,HKG,"Hong Kong, Special Administrative Region of China"
Japan,6,JPN,Japan
South Korea,7,KOR,"Korea, Republic of"
Taiwan,8,TWN,Taiwan
North Korea,9,XEA,Rest of East Asia
Macao SAR China,9,XEA,Rest of East Asia
Mongolia,9,XEA,Rest of East Asia
Indonesia,10,IDN,Indonesia
Malaysia,11,MYS,Malaysia
Philippines,12,PHL,Philippines
Singapore,13,SGP,Singapore
Thailand,14,THA,Thailand
Vietnam,15,VNM,Viet Nam
Brunei,16,XSE,Rest of Southeast Asia
Cambodia,16,XSE,Rest of Southeast Asia
Laos,16,XSE,Rest of Southeast Asia
Myanmar (Burma),16,XSE,Rest of Southeast Asia
Timor-Leste,16,XSE,Rest of Southeast Asia
Bangladesh,17,BGD,Bangladesh
India,18,IND,India
Sri Lanka,19,LKA,Sri Lanka
Afghanistan,20,XSA,Rest of South Asia
Bhutan,20,XSA,Rest of South Asia
Maldives,20,XSA,Rest of South Asia
Nepal,20,XSA,Rest of South Asia
Pakistan,20,XSA,Rest of South Asia
Canada,21,CAN,Canada
United States,22,USA,United States of America
Mexico,23,MEX,Mexico
Bermuda,24,XNA,Rest of North America
Greenland,24,XNA,Rest of North America
St. Pierre & Miquelon,24,XNA,Rest of North America
Colombia,25,COL,Colombia
Peru,26,PER,Peru
Venezuela,27,VEN,Venezuela (Bolivarian Republic of)
Bolivia,28,XAP,Rest of Andean Pact
Ecuador,28,XAP,Rest of Andean Pact
Argentina,29,ARG,Argentina
Brazil,30,BRA,Brazil
Chile,31,CHL,Chile
Uruguay,32,URY,Uruguay
Falkland Islands,33,XSM,Rest of South America
French Guiana,33,XSM,Rest of South America
Guyana,33,XSM,Rest of South America
Paraguay,33,XSM,Rest of South America
Suriname,33,XSM,Rest of South America
Belize,34,XCA,Central America
Costa Rica,34,XCA,Central America
El Salvador,34,XCA,Central America
Guatemala,34,XCA,Central America
Honduras,34,XCA,Central America
Nicaragua,34,XCA,Central America
Panama,34,XCA,Central America
Antigua & Barbuda,35,XFA,Rest of Free Trade Area of the Americas
Bahamas,35,XFA,Rest of Free Trade Area of the Americas
Barbados,35,XFA,Rest of Free Trade Area of the Americas
Dominica,35,XFA,Rest of Free Trade Area of the Americas
Dominican Republic,35,XFA,Rest of Free Trade Area of the Americas
Grenada,35,XFA,Rest of Free Trade Area of the Americas
Haiti,35,XFA,Rest of Free Trade Area of the Americas
Jamaica,35,XFA,Rest of Free Trade Area of the Americas
Puerto Rico,35,XFA,Rest of Free Trade Area of the Americas
St. Kitts & Nevis,35,XFA,Rest of Free Trade Area of the Americas
St. Lucia,35,XFA,Rest of Free Trade Area of the Americas
St. Vincent & Grenadines,35,XFA,Rest of Free Trade Area of the Americas
Trinidad & Tobago,35,XFA,Rest of Free Trade Area of the Americas
U.S. Virgin Islands,35,XFA,Rest of Free Trade Area of the Americas
Anguilla,36,XCB,Rest of the Caribbean
Aruba,36,XCB,Rest of the Caribbean
British Virgin Islands,36,XCB,Rest of the Caribbean
Cayman Islands,36,XCB,Rest of the Caribbean
Cuba,36,XCB,Rest of the Caribbean
Guadeloupe,36,XCB,Rest of the Caribbean
Martinique,36,XCB,Rest of the Caribbean
Montserrat,36,XCB,Rest of the Caribbean
Netherlands Antilles,36,XCB,Rest of the Caribbean
Turks & Caicos Islands,36,XCB,Rest of the Caribbean
Austria,37,AUT,Austria
Belgium,38,BEL,Belgium
Denmark,39,DNK,Denmark
Finland,40,FIN,Finland
France,41,FRA,France
Germany,42,DEU,Germany
United Kingdom,43,GBR,United Kingdom
Greece,44,GRC,Greece
Ireland,45,IRL,Ireland
Italy,46,ITA,Italy
Luxembourg,47,LUX,Luxembourg
Netherlands,48,NLD,Netherlands
Portugal,49,PRT,Portugal
Spain,50,ESP,Spain
Sweden,51,SWE,Sweden
Switzerland,52,CHE,Switzerland
Iceland,53,XEF,Rest of European Free Trade Association
Liechtenstein,53,XEF,Rest of European Free Trade Association
Norway,53,XEF,Rest of European Free Trade Association
Andorra,54,XER,Rest of Europe
Bosnia & Herzegovina,54,XER,Rest of Europe
Faroe Islands,54,XER,Rest of Europe
Gibraltar,54,XER,Rest of Europe
North Macedonia,54,XER,Rest of Europe
Monaco,54,XER,Rest of Europe
San Marino,54,XER,Rest of Europe
Serbia,54,XER,Rest of Europe
Albania,55,ALB,Albania
Bulgaria,56,BGR,Bulgaria
Croatia,57,HRV,Croatia
Cyprus,58,CYP,Cyprus
Czechia,59,CZE,Czech Republic
Hungary,60,HUN,Hungary
Malta,61,MLT,Malta
Poland,62,POL,Poland
Romania,63,ROU,Romania
Slovakia,64,SVK,Slovakia
Slovenia,65,SVN,Slovenia
Estonia,66,EST,Estonia
Latvia,67,LVA,Latvia
Lithuania,68,LTU,Lithuania
Russia,69,RUS,Russian Federation
Armenia,70,XSU,Rest of Former Soviet Union
Azerbaijan,70,XSU,Rest of Former Soviet Union
Belarus,70,XSU,Rest of Former Soviet Union
Georgia,70,XSU,Rest of Former Soviet Union
Kazakhstan,70,XSU,Rest of Former Soviet Union
Kyrgyzstan,70,XSU,Rest of Former Soviet Union
Moldova,70,XSU,Rest of Former Soviet Union
Tajikistan,70,XSU,Rest of Former Soviet Union
Turkmenistan,70,XSU,Rest of Former Soviet Union
Ukraine,70,XSU,Rest of Former Soviet Union
Uzbekistan,70,XSU,Rest of Former Soviet Union
Turkey,71,TUR,Turkey
Bahrain,72,XME,Rest of Middle East
Iran,72,XME,Rest of Middle East
Iraq,72,XME,Rest of Middle East
Israel,72,XME,Rest of Middle East
Jordan,72,XME,Rest of Middle East
Kuwait,72,XME,Rest of Middle East
Lebanon,72,XME,Rest of Middle East
Oman,72,XME,Rest of Middle East
Palestinian Territories,72,XME,Rest of Middle East
Qatar,72,XME,Rest of Middle East
Saudi Arabia,72,XME,Rest of Middle East
Syria,72,XME,Rest of Middle East
United Arab Emirates,72,XME,Rest of Middle East
Yemen,72,XME,Rest of Middle East
Morocco,73,MAR,Morocco
Tunisia,74,TUN,Tunisia
Algeria,75,XNF,Rest of North Africa
Egypt,75,XNF,Rest of North Africa
Libya,75,XNF,Rest of North Africa
Botswana,76,BWA,Botswana
South Africa,77,ZAF,South Africa
Lesotho,78,XSC,Rest of South African Customs Union
Namibia,78,XSC,Rest of South African Customs Union
Eswatini,78,XSC,Rest of South African Customs Union
Malawi,79,MWI,Malawi
Mozambique,80,MOZ,Mozambique
Tanzania,81,TZA,"Tanzania, United Republic of"
Zambia,82,ZMB,Zambia
Zimbabwe,83,ZWE,Zimbabwe
Angola,84,XSD,Rest of Southern African Development Community
Congo - Kinshasa,84,XSD,Rest of Southern African Development Community
Mauritius,84,XSD,Rest of Southern African Development Community
Seychelles,84,XSD,Rest of Southern African Development Community
Madagascar,85,MDG,Madagascar
Uganda,86,UGA,Uganda
Benin,87,XSS,Rest of Sub-Saharan Africa
Burkina Faso,87,XSS,Rest of Sub-Saharan Africa
Burundi,87,XSS,Rest of Sub-Saharan Africa
Cameroon,87,XSS,Rest of Sub-Saharan Africa
Cape Verde,87,XSS,Rest of Sub-Saharan Africa
Central African Republic,87,XSS,Rest of Sub-Saharan Africa
Chad,87,XSS,Rest of Sub-Saharan Africa
Comoros,87,XSS,Rest of Sub-Saharan Africa
Congo - Brazzaville,87,XSS,Rest of Sub-Saharan Africa
Côte d’Ivoire,87,XSS,Rest of Sub-Saharan Africa
Djibouti,87,XSS,Rest of Sub-Saharan Africa
Equatorial Guinea,87,XSS,Rest of Sub-Saharan Africa
Eritrea,87,XSS,Rest of Sub-Saharan Africa
Ethiopia,87,XSS,Rest of Sub-Saharan Africa
Gabon,87,XSS,Rest of Sub-Saharan Africa
Gambia,87,XSS,Rest of Sub-Saharan Africa
Ghana,87,XSS,Rest of Sub-Saharan Africa
Guinea,87,XSS,Rest of Sub-Saharan Africa
Guinea-Bissau,87,XSS,Rest of Sub-Saharan Africa
Kenya,87,XSS,Rest of Sub-Saharan Africa
Liberia,87,XSS,Rest of Sub-Saharan Africa
Mali,87,XSS,Rest of Sub-Saharan Africa
Mauritania,87,XSS,Rest of Sub-Saharan Africa
Mayotte,87,XSS,Rest of Sub-Saharan Africa
Niger,87,XSS,Rest of Sub-Saharan Africa
Nigeria,87,XSS,Rest of Sub-Saharan Africa
Réunion,87,XSS,Rest of Sub-Saharan Africa
Rwanda,87,XSS,Rest of Sub-Saharan Africa
St. Helena,87,XSS,Rest of Sub-Saharan Africa
São Tomé & Príncipe,87,XSS,Rest of Sub-Saharan Africa
Senegal,87,XSS,Rest of Sub-Saharan Africa
Sierra Leone,87,XSS,Rest of Sub-Saharan Africa
Somalia,87,XSS,Rest of Sub-Saharan Africa
Sudan,87,XSS,Rest of Sub-Saharan Africa
Togo,87,XSS,Rest of Sub-Saharan Africa


================================================
FILE: data/custom_dictionaries/data_gtap7.csv
================================================
country,gtap_num,gtap_code,gtap_name
Australia,1,AUS,Australia
New Zealand,2,NZL,New Zealand
American Samoa,3,XOC,Rest of Oceania
Cook Islands,3,XOC,Rest of Oceania
Fiji,3,XOC,Rest of Oceania
French Polynesia,3,XOC,Rest of Oceania
Guam,3,XOC,Rest of Oceania
Kiribati,3,XOC,Rest of Oceania
Marshall Islands,3,XOC,Rest of Oceania
Micronesia (Federated States of),3,XOC,Rest of Oceania
Nauru,3,XOC,Rest of Oceania
New Caledonia,3,XOC,Rest of Oceania
Niue,3,XOC,Rest of Oceania
Norfolk Island,3,XOC,Rest of Oceania
Northern Mariana Islands,3,XOC,Rest of Oceania
Palau,3,XOC,Rest of Oceania
Papua New Guinea,3,XOC,Rest of Oceania
Samoa,3,XOC,Rest of Oceania
Solomon Islands,3,XOC,Rest of Oceania
Tokelau,3,XOC,Rest of Oceania
Tonga,3,XOC,Rest of Oceania
Tuvalu,3,XOC,Rest of Oceania
Vanuatu,3,XOC,Rest of Oceania
Wallis & Futuna,3,XOC,Rest of Oceania
China,4,CHN,China
Hong Kong SAR China,5,HKG,"Hong Kong, Special Administrative Region of China"
Japan,6,JPN,Japan
South Korea,7,KOR,"Korea, Republic of"
Taiwan,8,TWN,Taiwan
North Korea,9,XEA,Rest of East Asia
Macao SAR China,9,XEA,Rest of East Asia
Mongolia,9,XEA,Rest of East Asia
Cambodia,10,KHM,Cambodia
Indonesia,11,IDN,Indonesia
Laos,12,LAO,Lao PDR
Myanmar (Burma),13,MMR,Myanmar
Malaysia,14,MYS,Malaysia
Philippines,15,PHL,Philippines
Singapore,16,SGP,Singapore
Thailand,17,THA,Thailand
Vietnam,18,VNM,Viet Nam
Brunei,19,XSE,Rest of Southeast Asia
Timor-Leste,19,XSE,Rest of Southeast Asia
Bangladesh,20,BGD,Bangladesh
India,21,IND,India
Pakistan,22,PAK,Pakistan
Sri Lanka,23,LKA,Sri Lanka
Afghanistan,24,XSA,Rest of South Asia
Bhutan,24,XSA,Rest of South Asia
Maldives,24,XSA,Rest of South Asia
Nepal,24,XSA,Rest of South Asia
Canada,25,CAN,Canada
United States,26,USA,United States of America
Mexico,27,MEX,Mexico
Bermuda,28,XNA,Rest of North America
Greenland,28,XNA,Rest of North America
St. Pierre & Miquelon,28,XNA,Rest of North America
Argentina,29,ARG,Argentina
Bolivia,30,BOL,Bolivia
Brazil,31,BRA,Brazil
Chile,32,CHL,Chile
Colombia,33,COL,Colombia
Ecuador,34,ECU,Ecuador
Paraguay,35,PRY,Paraguay
Peru,36,PER,Peru
Uruguay,37,URY,Uruguay
Venezuela,38,VEN,Venezuela (Bolivarian Republic of)
Falkland Islands,39,XSM,Rest of South America
French Guiana,39,XSM,Rest of South America
Guyana,39,XSM,Rest of South America
Suriname,39,XSM,Rest of South America
Costa Rica,40,CRI,Costa Rica
Guatemala,41,GTM,Guatemala
Nicaragua,42,NIC,Nicaragua
Panama,43,PAN,Panama
Belize,44,XCA,Rest of Central America
El Salvador,44,XCA,Rest of Central America
Honduras,44,XCA,Rest of Central America
Anguilla,45,XCB,Rest of Caribbean
Antigua & Barbuda,45,XCB,Rest of Caribbean
Aruba,45,XCB,Rest of Caribbean
Bahamas,45,XCB,Rest of Caribbean
Barbados,45,XCB,Rest of Caribbean
British Virgin Islands,45,XCB,Rest of Caribbean
Cayman Islands,45,XCB,Rest of Caribbean
Cuba,45,XCB,Rest of Caribbean
Dominica,45,XCB,Rest of Caribbean
Dominican Republic,45,XCB,Rest of Caribbean
Grenada,45,XCB,Rest of Caribbean
Guadeloupe,45,XCB,Rest of Caribbean
Haiti,45,XCB,Rest of Caribbean
Jamaica,45,XCB,Rest of Caribbean
Martinique,45,XCB,Rest of Caribbean
Montserrat,45,XCB,Rest of Caribbean
Netherlands Antilles,45,XCB,Rest of Caribbean
Puerto Rico,45,XCB,Rest of Caribbean
St. Kitts & Nevis,45,XCB,Rest of Caribbean
St. Lucia,45,XCB,Rest of Caribbean
St. Vincent & Grenadines,45,XCB,Rest of Caribbean
Trinidad & Tobago,45,XCB,Rest of Caribbean
Turks & Caicos Islands,45,XCB,Rest of Caribbean
U.S. Virgin Islands,45,XCB,Rest of Caribbean
Austria,46,AUT,Austria
Belgium,47,BEL,Belgium
Cyprus,48,CYP,Cyprus
Czechia,49,CZE,Czech Republic
Denmark,50,DNK,Denmark
Estonia,51,EST,Estonia
Finland,52,FIN,Finland
France,53,FRA,France
Germany,54,DEU,Germany
Greece,55,GRC,Greece
Hungary,56,HUN,Hungary
Ireland,57,IRL,Ireland
Italy,58,ITA,Italy
Latvia,59,LVA,Latvia
Lithuania,60,LTU,Lithuania
Luxembourg,61,LUX,Luxembourg
Malta,62,MLT,Malta
Netherlands,63,NLD,Netherlands
Poland,64,POL,Poland
Portugal,65,PRT,Portugal
Slovakia,66,SVK,Slovakia
Slovenia,67,SVN,Slovenia
Spain,68,ESP,Spain
Sweden,69,SWE,Sweden
United Kingdom,70,GBR,United Kingdom
Switzerland,71,CHE,Switzerland
Norway,72,NOR,Norway
Iceland,73,XEF,Rest of European Free Trade Association
Liechtenstein,73,XEF,Rest of European Free Trade Association
Albania,74,ALB,Albania
Bulgaria,75,BGR,Bulgaria
Belarus,76,BLR,Belarus
Croatia,77,HRV,Croatia
Romania,78,ROU,Romania
Russia,79,RUS,Russian Federation
Ukraine,80,UKR,Ukraine
Moldova,81,XEE,Rest of Eastern Europe
Andorra,82,XER,Rest of Europe
Bosnia & Herzegovina,82,XER,Rest of Europe
Faroe Islands,82,XER,Rest of Europe
Gibraltar,82,XER,Rest of Europe
North Macedonia,82,XER,Rest of Europe
Monaco,82,XER,Rest of Europe
San Marino,82,XER,Rest of Europe
Serbia,82,XER,Rest of Europe
Kazakhstan,83,KAZ,Kazakhstan
Kyrgyzstan,84,KGZ,Kyrgyzstan
Tajikistan,85,XSU,Rest of Former Soviet Union
Turkmenistan,85,XSU,Rest of Former Soviet Union
Uzbekistan,85,XSU,Rest of Former Soviet Union
Armenia,86,ARM,Armenia
Azerbaijan,87,AZE,Azerbaijan
Georgia,88,GEO,Georgia
Iran,89,IRN,"Iran, Islamic Republic of"
Turkey,90,TUR,Turkey
Bahrain,91,XWS,Rest of Western Asia
Iraq,91,XWS,Rest of Western Asia
Israel,91,XWS,Rest of Western Asia
Jordan,91,XWS,Rest of Western Asia
Kuwait,91,XWS,Rest of Western Asia
Lebanon,91,XWS,Rest of Western Asia
Oman,91,XWS,Rest of Western Asia
Palestinian Territories,91,XWS,Rest of Western Asia
Qatar,91,XWS,Rest of Western Asia
Saudi Arabia,91,XWS,Rest of Western Asia
Syria,91,XWS,Rest of Western Asia
United Arab Emirates,91,XWS,Rest of Western Asia
Yemen,91,XWS,Rest of Western Asia
Egypt,92,EGY,Egypt
Morocco,93,MAR,Morocco
Tunisia,94,TUN,Tunisia
Algeria,95,XNF,Rest of North Africa
Libya,95,XNF,Rest of North Africa
Nigeria,96,NGA,Nigeria
Senegal,97,SEN,Senegal
Benin,98,XWF,Rest of Western Africa
Burkina Faso,98,XWF,Rest of Western Africa
Cape Verde,98,XWF,Rest of Western Africa
Côte d’Ivoire,98,XWF,Rest of Western Africa
Gambia,98,XWF,Rest of Western Africa
Ghana,98,XWF,Rest of Western Africa
Guinea,98,XWF,Rest of Western Africa
Guinea-Bissau,98,XWF,Rest of Western Africa
Liberia,98,XWF,Rest of Western Africa
Mali,98,XWF,Rest of Western Africa
Mauritania,98,XWF,Rest of Western Africa
Niger,98,XWF,Rest of Western Africa
St. Helena,98,XWF,Rest of Western Africa
Sierra Leone,98,XWF,Rest of Western Africa
Togo,98,XWF,Rest of Western Africa
Cameroon,99,XCF,Rest of Central Africa
Central African Republic,99,XCF,Rest of Central Africa
Chad,99,XCF,Rest of Central Africa
Congo - Brazzaville,99,XCF,Rest of Central Africa
Equatorial Guinea,99,XCF,Rest of Central Africa
Gabon,99,XCF,Rest of Central Africa
São Tomé & Príncipe,99,XCF,Rest of Central Africa
Angola,100,XAC,Rest of South Central Africa
Congo - Kinshasa,100,XAC,Rest of South Central Africa
Ethiopia,101,ETH,Ethiopia
Madagascar,102,MDG,Madagascar
Malawi,103,MWI,Malawi
Mauritius,104,MUS,Mauritius
Mozambique,105,MOZ,Mozambique
Tanzania,106,TZA,"Tanzania, United Republic of"
Uganda,107,UGA,Uganda
Zambia,108,ZMB,Zambia
Zimbabwe,109,ZWE,Zimbabwe
Burundi,110,XEC,Rest of Eastern Africa
Comoros,110,XEC,Rest of Eastern Africa
Djibouti,110,XEC,Rest of Eastern Africa
Eritrea,110,XEC,Rest of Eastern Africa
Kenya,110,XEC,Rest of Eastern Africa
Mayotte,110,XEC,Rest of Eastern Africa
Réunion,110,XEC,Rest of Eastern Africa
Rwanda,110,XEC,Rest of Eastern Africa
Seychelles,110,XEC,Rest of Eastern Africa
Somalia,110,XEC,Rest of Eastern Africa
Sudan,110,XEC,Rest of Eastern Africa
Botswana,111,BWA,Botswana
South Africa,112,ZAF,South Africa
Lesotho,113,XSC,Rest of South African Customs Union
Namibia,113,XSC,Rest of South African Customs Union
Eswatini,113,XSC,Rest of South African Customs Union


================================================
FILE: data/custom_dictionaries/data_gtap8.csv
================================================
country,gtap_num,gtap_code,gtap_name
Australia,1,AUS,Australia
Christmas Island,1,AUS,Australia
Cocos (Keeling) Islands,1,AUS,Australia
Heard & McDonald Islands,1,AUS,Australia
Norfolk Island,1,AUS,Australia
New Zealand,2,NZL,New Zealand
American Samoa,3,XOC,Rest of Oceania
Cook Islands,3,XOC,Rest of Oceania
Fiji,3,XOC,Rest of Oceania
French Polynesia,3,XOC,Rest of Oceania
Guam,3,XOC,Rest of Oceania
Kiribati,3,XOC,Rest of Oceania
Marshall Islands,3,XOC,Rest of Oceania
Micronesia (Federated States of),3,XOC,Rest of Oceania
Nauru,3,XOC,Rest of Oceania
New Caledonia,3,XOC,Rest of Oceania
Niue,3,XOC,Rest of Oceania
Northern Mariana Islands,3,XOC,Rest of Oceania
Palau,3,XOC,Rest of Oceania
Papua New Guinea,3,XOC,Rest of Oceania
Pitcairn Islands,3,XOC,Rest of Oceania
Samoa,3,XOC,Rest of Oceania
Solomon Islands,3,XOC,Rest of Oceania
Tokelau,3,XOC,Rest of Oceania
Tonga,3,XOC,Rest of Oceania
Tuvalu,3,XOC,Rest of Oceania
United States Minor Outlying Islands (the),3,XOC,Rest of Oceania
Vanuatu,3,XOC,Rest of Oceania
Wallis & Futuna,3,XOC,Rest of Oceania
China,4,CHN,China
Hong Kong SAR China,5,HKG,"Hong Kong, Special Administrative Region of China"
Japan,6,JPN,Japan
South Korea,7,KOR,"Korea, Republic of"
Mongolia,8,MNG,Mongolia
Taiwan,9,TWN,Taiwan
North Korea,10,XEA,Rest of East Asia
Macao SAR China,10,XEA,Rest of East Asia
Cambodia,11,KHM,Cambodia
Indonesia,12,IDN,Indonesia
Laos,13,LAO,Lao PDR
Malaysia,14,MYS,Malaysia
Philippines,15,PHL,Philippines
Singapore,16,SGP,Singapore
Thailand,17,THA,Thailand
Vietnam,18,VNM,Viet Nam
Brunei,19,XSE,Rest of Southeast Asia
Myanmar (Burma),19,XSE,Rest of Southeast Asia
Timor-Leste,19,XSE,Rest of Southeast Asia
Bangladesh,20,BGD,Bangladesh
India,21,IND,India
Nepal,22,NPL,Nepal
Pakistan,23,PAK,Pakistan
Sri Lanka,24,LKA,Sri Lanka
Afghanistan,25,XSA,Rest of South Asia
Bhutan,25,XSA,Rest of South Asia
Maldives,25,XSA,Rest of South Asia
Canada,26,CAN,Canada
United States,27,USA,United States of America
Mexico,28,MEX,Mexico
Bermuda,29,XNA,Rest of North America
Greenland,29,XNA,Rest of North America
St. Pierre & Miquelon,29,XNA,Rest of North America
Argentina,30,ARG,Argentina
Bolivia,31,BOL,Bolivia
Brazil,32,BRA,Brazil
Chile,33,CHL,Chile
Colombia,34,COL,Colombia
Ecuador,35,ECU,Ecuador
Paraguay,36,PRY,Paraguay
Peru,37,PER,Peru
Uruguay,38,URY,Uruguay
Venezuela,39,VEN,Venezuela (Bolivarian Republic of)
Falkland Islands,40,XSM,Rest of South America
French Guiana,40,XSM,Rest of South America
Guyana,40,XSM,Rest of South America
South Georgia & South Sandwich Islands,40,XSM,Rest of South America
Suriname,40,XSM,Rest of South America
Costa Rica,41,CRI,Costa Rica
Guatemala,42,GTM,Guatemala
Honduras,43,HND,Honduras
Nicaragua,44,NIC,Nicaragua
Panama,45,PAN,Panama
El Salvador,46,SLV,El Salvador
Belize,47,XCA,Rest of Central America
Anguilla,48,XCB,Rest of Caribbean
Antigua & Barbuda,48,XCB,Rest of Caribbean
Aruba,48,XCB,Rest of Caribbean
Bahamas,48,XCB,Rest of Caribbean
Barbados,48,XCB,Rest of Caribbean
British Virgin Islands,48,XCB,Rest of Caribbean
Cayman Islands,48,XCB,Rest of Caribbean
Cuba,48,XCB,Rest of Caribbean
Dominica,48,XCB,Rest of Caribbean
Dominican Republic,48,XCB,Rest of Caribbean
Grenada,48,XCB,Rest of Caribbean
Haiti,48,XCB,Rest of Caribbean
Jamaica,48,XCB,Rest of Caribbean
Montserrat,48,XCB,Rest of Caribbean
Netherlands Antilles,48,XCB,Rest of Caribbean
Puerto Rico,48,XCB,Rest of Caribbean
St. Kitts & Nevis,48,XCB,Rest of Caribbean
St. Lucia,48,XCB,Rest of Caribbean
St. Vincent & Grenadines,48,XCB,Rest of Caribbean
Trinidad & Tobago,48,XCB,Rest of Caribbean
Turks & Caicos Islands,48,XCB,Rest of Caribbean
U.S. Virgin Islands,48,XCB,Rest of Caribbean
Austria,49,AUT,Austria
Belgium,50,BEL,Belgium
Cyprus,51,CYP,Cyprus
Czechia,52,CZE,Czech Republic
Denmark,53,DNK,Denmark
Estonia,54,EST,Estonia
Finland,55,FIN,Finland
Åland Islands,55,FIN,Finland
France,56,FRA,France
Guadeloupe,56,FRA,France
Martinique,56,FRA,France
Réunion,56,FRA,France
Germany,57,DEU,Germany
Greece,58,GRC,Greece
Hungary,59,HUN,Hungary
Ireland,60,IRL,Ireland
Italy,61,ITA,Italy
Latvia,62,LVA,Latvia
Lithuania,63,LTU,Lithuania
Luxembourg,64,LUX,Luxembourg
Malta,65,MLT,Malta
Netherlands,66,NLD,Netherlands
Poland,67,POL,Poland
Portugal,68,PRT,Portugal
Slovakia,69,SVK,Slovakia
Slovenia,70,SVN,Slovenia
Spain,71,ESP,Spain
Sweden,72,SWE,Sweden
United Kingdom,73,GBR,United Kingdom
Switzerland,74,CHE,Switzerland
Norway,75,NOR,Norway
Svalbard & Jan Mayen,75,NOR,Norway
Iceland,76,XEF,Rest of European Free Trade Association
Liechtenstein,76,XEF,Rest of European Free Trade Association
Albania,77,ALB,Albania
Bulgaria,78,BGR,Bulgaria
Belarus,79,BLR,Belarus
Croatia,80,HRV,Croatia
Romania,81,ROU,Romania
Russia,82,RUS,Russian Federation
Ukraine,83,UKR,Ukraine
Moldova,84,XEE,Rest of Eastern Europe
Andorra,85,XER,Rest of Europe
Bosnia & Herzegovina,85,XER,Rest of Europe
Faroe Islands,85,XER,Rest of Europe
Gibraltar,85,XER,Rest of Europe
Guernsey,85,XER,Rest of Europe
Vatican City,85,XER,Rest of Europe
Isle of Man,85,XER,Rest of Europe
Jersey,85,XER,Rest of Europe
North Macedonia,85,XER,Rest of Europe
Monaco,85,XER,Rest of Europe
Montenegro,85,XER,Rest of Europe
San Marino,85,XER,Rest of Europe
Serbia,85,XER,Rest of Europe
Kazakhstan,86,KAZ,Kazakhstan
Kyrgyzstan,87,KGZ,Kyrgyzstan
Tajikistan,88,XSU,Rest of Former Soviet Union
Turkmenistan,88,XSU,Rest of Former Soviet Union
Uzbekistan,88,XSU,Rest of Former Soviet Union
Armenia,89,ARM,Armenia
Azerbaijan,90,AZE,Azerbaijan
Georgia,91,GEO,Georgia
Bahrain,92,BHR,Bahrain
Iran,93,IRN,"Iran, Islamic Republic of"
Israel,94,ISR,Israel
Kuwait,95,KWT,Kuwait
Oman,96,OMN,Oman
Qatar,97,QAT,Qatar
Saudi Arabia,98,SAU,Saudi Arabia
Turkey,99,TUR,Turkey
United Arab Emirates,100,ARE,United Arab Emirates
Iraq,101,XWS,Rest of Western Asia
Jordan,101,XWS,Rest of Western Asia
Lebanon,101,XWS,Rest of Western Asia
Palestinian Territories,101,XWS,Rest of Western Asia
Syria,101,XWS,Rest of Western Asia
Yemen,101,XWS,Rest of Western Asia
Egypt,102,EGY,Egypt
Morocco,103,MAR,Morocco
Tunisia,104,TUN,Tunisia
Algeria,105,XNF,Rest of North Africa
Libya,105,XNF,Rest of North Africa
Western Sahara,105,XNF,Rest of North Africa
Cameroon,106,CMR,Cameroon
Côte d’Ivoire,107,CIV,Côte d'Ivoire
Ghana,108,GHA,Ghana
Nigeria,109,NGA,Nigeria
Senegal,110,SEN,Senegal
Benin,111,XWF,Rest of Western Africa
Burkina Faso,111,XWF,Rest of Western Africa
Cape Verde,111,XWF,Rest of Western Africa
Gambia,111,XWF,Rest of Western Africa
Guinea,111,XWF,Rest of Western Africa
Guinea-Bissau,111,XWF,Rest of Western Africa
Liberia,111,XWF,Rest of Western Africa
Mali,111,XWF,Rest of Western Africa
Mauritania,111,XWF,Rest of Western Africa
Niger,111,XWF,Rest of Western Africa
St. Helena,111,XWF,Rest of Western Africa
Sierra Leone,111,XWF,Rest of Western Africa
Togo,111,XWF,Rest of Western Africa
Central African Republic,112,XCF,Rest of Central Africa
Chad,112,XCF,Rest of Central Africa
Congo - Brazzaville,112,XCF,Rest of Central Africa
Equatorial Guinea,112,XCF,Rest of Central Africa
Gabon,112,XCF,Rest of Central Africa
São Tomé & Príncipe,112,XCF,Rest of Central Africa
Angola,113,XAC,South Central Africa
Congo - Kinshasa,113,XAC,South Central Africa
Ethiopia,114,ETH,Ethiopia
Kenya,115,KEN,Kenya
Madagascar,116,MDG,Madagascar
Malawi,117,MWI,Malawi
Mauritius,118,MUS,Mauritius
Mozambique,119,MOZ,Mozambique
Tanzania,120,TZA,"Tanzania, United Republic of"
Uganda,121,UGA,Uganda
Zambia,122,ZMB,Zambia
Zimbabwe,123,ZWE,Zimbabwe
Burundi,124,XEC,Rest of Eastern Africa
Comoros,124,XEC,Rest of Eastern Africa
Djibouti,124,XEC,Rest of Eastern Africa
Eritrea,124,XEC,Rest of Eastern Africa
Mayotte,124,XEC,Rest of Eastern Africa
Rwanda,124,XEC,Rest of Eastern Africa
Seychelles,124,XEC,Rest of Eastern Africa
Somalia,124,XEC,Rest of Eastern Africa
Sudan,124,XEC,Rest of Eastern Africa
Botswana,125,BWA,Botswana
Namibia,126,NAM,Namibia
South Africa,127,ZAF,South Africa
Lesotho,128,XSC,Rest of South African Customs Union
Eswatini,128,XSC,Rest of South African Customs Union
Antarctica,129,XTW,Rest of the World
Bouvet Island,129,XTW,Rest of the World
British Indian Ocean Territory,129,XTW,Rest of the World
French Southern Territories,129,XTW,Rest of the World


================================================
FILE: data/custom_dictionaries/data_gtap9.csv
================================================
country,gtap_num,gtap_code,gtap_name
Australia,1,AUS,Australia
Christmas Island,1,AUS,Australia
Cocos (Keeling) Islands,1,AUS,Australia
Heard & McDonald Islands,1,AUS,Australia
Norfolk Island,1,AUS,Australia
New Zealand,2,NZL,New Zealand
American Samoa,3,XOC,Rest of Oceania
Cook Islands,3,XOC,Rest of Oceania
Fiji,3,XOC,Rest of Oceania
French Polynesia,3,XOC,Rest of Oceania
Guam,3,XOC,Rest of Oceania
Kiribati,3,XOC,Rest of Oceania
Marshall Islands,3,XOC,Rest of Oceania
Micronesia (Federated States of),3,XOC,Rest of Oceania
Nauru,3,XOC,Rest of Oceania
New Caledonia,3,XOC,Rest of Oceania
Niue,3,XOC,Rest of Oceania
Northern Mariana Islands,3,XOC,Rest of Oceania
Palau,3,XOC,Rest of Oceania
Papua New Guinea,3,XOC,Rest of Oceania
Pitcairn Islands,3,XOC,Rest of Oceania
Samoa,3,XOC,Rest of Oceania
Solomon Islands,3,XOC,Rest of Oceania
Tokelau,3,XOC,Rest of Oceania
Tonga,3,XOC,Rest of Oceania
Tuvalu,3,XOC,Rest of Oceania
United States Minor Outlying Islands (the),3,XOC,Rest of Oceania
Vanuatu,3,XOC,Rest of Oceania
Wallis & Futuna,3,XOC,Rest of Oceania
China,4,CHN,China
Hong Kong SAR China,5,HKG,"Hong Kong, Special Administrative Region of China"
Japan,6,JPN,Japan
South Korea,7,KOR,"Korea, Republic of"
Mongolia,8,MNG,Mongolia
Taiwan,9,TWN,Taiwan
North Korea,10,XEA,Rest of East Asia
Macao SAR China,10,XEA,Rest of East Asia
Brunei,11,BRN,Brunei Darussalam
Cambodia,12,KHM,Cambodia
Indonesia,13,IDN,Indonesia
Laos,14,LAO,Lao PDR
Malaysia,15,MYS,Malaysia
Philippines,16,PHL,Philippines
Singapore,17,SGP,Singapore
Thailand,18,THA,Thailand
Vietnam,19,VNM,Viet Nam
Myanmar (Burma),20,XSE,Rest of Southeast Asia
Timor-Leste,20,XSE,Rest of Southeast Asia
Bangladesh,21,BGD,Bangladesh
India,22,IND,India
Nepal,23,NPL,Nepal
Pakistan,24,PAK,Pakistan
Sri Lanka,25,LKA,Sri Lanka
Afghanistan,26,XSA,Rest of South Asia
Bhutan,26,XSA,Rest of South Asia
Maldives,26,XSA,Rest of South Asia
Canada,27,CAN,Canada
United States,28,USA,United States of America
Mexico,29,MEX,Mexico
Bermuda,30,XNA,Rest of North America
Greenland,30,XNA,Rest of North America
St. Pierre & Miquelon,30,XNA,Rest of North America
Argentina,31,ARG,Argentina
Bolivia,32,BOL,Bolivia
Brazil,33,BRA,Brazil
Chile,34,CHL,Chile
Colombia,35,COL,Colombia
Ecuador,36,ECU,Ecuador
Paraguay,37,PRY,Paraguay
Peru,38,PER,Peru
Uruguay,39,URY,Uruguay
Venezuela,40,VEN,Venezuela (Bolivarian Republic of)
Falkland Islands,41,XSM,Rest of South America
French Guiana,41,XSM,Rest of South America
Guyana,41,XSM,Rest of South America
South Georgia & South Sandwich Islands,41,XSM,Rest of South America
Suriname,41,XSM,Rest of South America
Costa Rica,42,CRI,Costa Rica
Guatemala,43,GTM,Guatemala
Honduras,44,HND,Honduras
Nicaragua,45,NIC,Nicaragua
Panama,46,PAN,Panama
El Salvador,47,SLV,El Salvador
Belize,48,XCA,Rest of Central America
Dominican Republic,49,DOM,Dominican Republic P
Jamaica,50,JAM,Jamaica
Puerto Rico,51,PRI,Puerto Rico
Trinidad & Tobago,52,TTO,Trinidad and Tobago P
Anguilla,53,XCB,Rest of Caribbean
Antigua & Barbuda,53,XCB,Rest of Caribbean
Aruba,53,XCB,Rest of Caribbean
Bahamas,53,XCB,Rest of Caribbean
Barbados,53,XCB,Rest of Caribbean
British Virgin Islands,53,XCB,Rest of Caribbean
Cayman Islands,53,XCB,Rest of Caribbean
Cuba,53,XCB,Rest of Caribbean
Dominica,53,XCB,Rest of Caribbean
Grenada,53,XCB,Rest of Caribbean
Haiti,53,XCB,Rest of Caribbean
Montserrat,53,XCB,Rest of Caribbean
Netherlands Antilles,53,XCB,Rest of Caribbean
St. Kitts & Nevis,53,XCB,Rest of Caribbean
St. Lucia,53,XCB,Rest of Caribbean
St. Vincent & Grenadines,53,XCB,Rest of Caribbean
Turks & Caicos Islands,53,XCB,Rest of Caribbean
U.S. Virgin Islands,53,XCB,Rest of Caribbean
Austria,54,AUT,Austria
Belgium,55,BEL,Belgium
Cyprus,56,CYP,Cyprus
Czechia,57,CZE,Czech Republic
Denmark,58,DNK,Denmark
Estonia,59,EST,Estonia
Finland,60,FIN,Finland
Åland Islands,60,FIN,Finland
France,61,FRA,France
Guadeloupe,61,FRA,France
Martinique,61,FRA,France
Réunion,61,FRA,France
Germany,62,DEU,Germany
Greece,63,GRC,Greece
Hungary,64,HUN,Hungary
Ireland,65,IRL,Ireland
Italy,66,ITA,Italy
Latvia,67,LVA,Latvia
Lithuania,68,LTU,Lithuania
Luxembourg,69,LUX,Luxembourg
Malta,70,MLT,Malta
Netherlands,71,NLD,Netherlands
Poland,72,POL,Poland
Portugal,73,PRT,Portugal
Slovakia,74,SVK,Slovakia
Slovenia,75,SVN,Slovenia
Spain,76,ESP,Spain
Sweden,77,SWE,Sweden
United Kingdom,78,GBR,United Kingdom
Switzerland,79,CHE,Switzerland
Norway,80,NOR,Norway
Svalbard & Jan Mayen,80,NOR,Norway
Iceland,81,XEF,Rest of European Free Trade Association
Liechtenstein,81,XEF,Rest of European Free Trade Association
Albania,82,ALB,Albania
Bulgaria,83,BGR,Bulgaria
Belarus,84,BLR,Belarus
Croatia,85,HRV,Croatia
Romania,86,ROU,Romania
Russia,87,RUS,Russian Federation
Ukraine,88,UKR,Ukraine
Moldova,89,XEE,Rest of Eastern Europe
Andorra,90,XER,Rest of Europe
Bosnia & Herzegovina,90,XER,Rest of Europe
Faroe Islands,90,XER,Rest of Europe
Gibraltar,90,XER,Rest of Europe
Guernsey,90,XER,Rest of Europe
Vatican City,90,XER,Rest of Europe
Isle of Man,90,XER,Rest of Europe
Jersey,90,XER,Rest of Europe
North Macedonia,90,XER,Rest of Europe
Monaco,90,XER,Rest of Europe
Montenegro,90,XER,Rest of Europe
San Marino,90,XER,Rest of Europe
Serbia,90,XER,Rest of Europe
Kazakhstan,91,KAZ,Kazakhstan
Kyrgyzstan,92,KGZ,Kyrgyzstan
Tajikistan,93,XSU,Rest of Former Soviet Union
Turkmenistan,93,XSU,Rest of Former Soviet Union
Uzbekistan,93,XSU,Rest of Former Soviet Union
Armenia,94,ARM,Armenia
Azerbaijan,95,AZE,Azerbaijan
Georgia,96,GEO,Georgia
Bahrain,97,BHR,Bahrain
Iran,98,IRN,"Iran, Islamic Republic of"
Israel,99,ISR,Israel
Jordan,100,JOR,Jordan
Kuwait,101,KWT,Kuwait
Oman,102,OMN,Oman
Qatar,103,QAT,Qatar
Saudi Arabia,104,SAU,Saudi Arabia
Turkey,105,TUR,Turkey
United Arab Emirates,106,ARE,United Arab Emirates
Iraq,107,XWS,Rest of Western Asia
Lebanon,107,XWS,Rest of Western Asia
Palestinian Territories,107,XWS,Rest of Western Asia
Syria,107,XWS,Rest of Western Asia
Yemen,107,XWS,Rest of Western Asia
Egypt,108,EGY,Egypt
Morocco,109,MAR,Morocco
Tunisia,110,TUN,Tunisia
Algeria,111,XNF,Rest of North Africa
Libya,111,XNF,Rest of North Africa
Western Sahara,111,XNF,Rest of North Africa
Benin,112,BEN,Benin
Burkina Faso,113,BFA,Burkina Faso
Cameroon,114,CMR,Cameroon
Côte d’Ivoire,115,CIV,Côte d'Ivoire
Ghana,116,GHA,Ghana
Guinea,117,GIN,Guinea
Nigeria,118,NGA,Nigeria
Senegal,119,SEN,Senegal
Togo,120,TGO,Togo
Cape Verde,121,XWF,Rest of Western Africa
Gambia,121,XWF,Rest of Western Africa
Guinea-Bissau,121,XWF,Rest of Western Africa
Liberia,121,XWF,Rest of Western Africa
Mali,121,XWF,Rest of Western Africa
Mauritania,121,XWF,Rest of Western Africa
Niger,121,XWF,Rest of Western Africa
St. Helena,121,XWF,Rest of Western Africa
Sierra Leone,121,XWF,Rest of Western Africa
Central African Republic,122,XCF,Rest of Central Africa
Chad,122,XCF,Rest of Central Africa
Congo - Brazzaville,122,XCF,Rest of Central Africa
Equatorial Guinea,122,XCF,Rest of Central Africa
Gabon,122,XCF,Rest of Central Africa
São Tomé & Príncipe,122,XCF,Rest of Central Africa
Angola,123,XAC,South Central Africa
Congo - Kinshasa,123,XAC,South Central Africa
Ethiopia,124,ETH,Ethiopia
Kenya,125,KEN,Kenya
Madagascar,126,MDG,Madagascar
Malawi,127,MWI,Malawi
Mauritius,128,MUS,Mauritius
Mozambique,129,MOZ,Mozambique
Rwanda,130,RWA,Rwanda
Tanzania,131,TZA,"Tanzania, United Republic of"
Uganda,132,UGA,Uganda
Zambia,133,ZMB,Zambia
Zimbabwe,134,ZWE,Zimbabwe
Burundi,135,XEC,Rest of Eastern Africa
Comoros,135,XEC,Rest of Eastern Africa
Djibouti,135,XEC,Rest of Eastern Africa
Eritrea,135,XEC,Rest of Eastern Africa
Mayotte,135,XEC,Rest of Eastern Africa
Seychelles,135,XEC,Rest of Eastern Africa
Somalia,135,XEC,Rest of Eastern Africa
Sudan,135,XEC,Rest of Eastern Africa
Botswana,136,BWA,Botswana
Namibia,137,NAM,Namibia
South Africa,138,ZAF,South Africa
Lesotho,139,XSC,Rest of South African Customs Union
Eswatini,139,XSC,Rest of South African Customs Union
Antarctica,140,XTW,Rest of the World
Bouvet Island,140,XTW,Rest of the World
British Indian Ocean Territory,140,XTW,Rest of the World
French Southern Territories,140,XTW,Rest of the World


================================================
FILE: data/custom_dictionaries/data_us_states.csv
================================================
"state","abbreviation","state.regex"
"Alabama","AL",".*alabama.*"
"Alaska","AK",".*alaska.*"
"Arizona","AZ",".*arizona.*"
"Arkansas","AR",".*arkansas.*"
"California","CA",".*california.*"
"Colorado","CO",".*colorado.*"
"Connecticut","CT",".*connecticut.*"
"Delaware","DE",".*delaware.*"
"Florida","FL",".*florida.*"
"Georgia","GA",".*georgia.*"
"Hawaii","HI",".*hawaii.*"
"Idaho","ID",".*idaho.*"
"Illinois","IL",".*illinois.*"
"Indiana","IN",".*indiana.*"
"Iowa","IA",".*iowa.*"
"Kansas","KS","^(?!.*ar).*kansas.*"
"Kentucky","KY",".*kentucky.*"
"Louisiana","LA",".*louisiana.*"
"Maine","ME",".*maine.*"
"Maryland","MD",".*maryland.*"
"Massachusetts","MA",".*massachusetts.*"
"Michigan","MI",".*michigan.*"
"Minnesota","MN",".*minnesota.*"
"Mississippi","MS",".*mississippi.*"
"Missouri","MO",".*missouri.*"
"Montana","MT",".*montana.*"
"Nebraska","NE",".*nebraska.*"
"Nevada","NV",".*nevada.*"
"New Hampshire","NH",".*new.*hampshire.*"
"New Jersey","NJ",".*new.*jersey.*"
"New Mexico","NM",".*new.*mexico.*"
"New York","NY",".*new.*york.*"
"North Carolina","NC",".*north.*carolina.*"
"North Dakota","ND",".*north.*dakota.*"
"Ohio","OH",".*ohio.*"
"Oklahoma","OK",".*oklahoma.*"
"Oregon","OR",".*oregon.*"
"Pennsylvania","PA",".*pennsylvania.*"
"Rhode Island","RI",".*rhode.*island.*"
"South Carolina","SC",".*south.*carolina.*"
"South Dakota","SD",".*south.*dakota.*"
"Tennessee","TN",".*tennessee.*"
"Texas","TX",".*texas.*"
"Utah","UT",".*utah.*"
"Vermont","VT",".*vermont.*"
"Virginia","VA","^(?!.*west).*virginia.*"
"Washington","WA",".*washington.*"
"West Virginia","WV",".*west.*virginia.*"
"Wisconsin","WI",".*wisconsin.*"
"Wyoming","WY",".*wyoming.*"


================================================
FILE: data/custom_dictionaries/get_ch_cantons.R
================================================
source(here::here("dictionary/utilities.R"))

tmp <- read.csv(here("data/custom_dictionaries/data_ch_cantons.csv")) |>
    unique() |>
    rename(canton.abb = abbreviation)
attr(tmp, "origin_regex") <- "canton.name.regex"
attr(tmp, "valid_origin") <- colnames(tmp)

saveRDS(tmp, here("data/custom_dictionaries/data_ch_cantons.rds"))


================================================
FILE: data/custom_dictionaries/get_exiobase3.R
================================================
source(here::here("dictionary/utilities.R"))

# This file cannot run automatically because the original files cannot be
# downloaded by R.
# To run this file, remove the comments and download the file
# CountryMappingDESIRE.xlsx from https://ntnu.app.box.com/v/EXIOBASEconcordances

## source(here::here("dictionary/utilities.R"))

## data <-
##   here("dictionary", "CountryMappingDESIRE.xlsx") %>%
##   read_excel(sheet = "CountryList")

## exiobase <-
##   data %>%
##   mutate(
##     Name = case_match(
##       Name,
##       "Heard and mc donald islands" ~ "Heard and mcdonald islands",
##       .default = Name
##     ),
##     country = countrycode(.data$Name,
##                           origin = "country.name",
##                           destination = "country.name",
##                           warn = FALSE)
##   )

## # Check missing countries
## exiobase %>%
##   filter(is.na(country)) %>%
##   select(Name)

## exiobase <-
##   exiobase %>%
##   filter(!is.na(country)) %>%
##   select(
##     country,
##     exiobase_code = `DESIRE code`,
##     exiobase_num = `DESIRE Number`
##   )

## write_csv(
##   exiobase,
##   here("dictionary", "data_exiobase3.csv"),
##   na = ""
## )


tmp <- read.csv(here("data/custom_dictionaries/data_exiobase3.csv")) |>
    unique() |>
    transform(country.name.en.regex = countrycode(country, "country.name", "country.name.en.regex")) |>
    select(country.name = country,
           country.name.en.regex,
           exiobase.num = exiobase_num,
           exiobase.cha = exiobase_code)
attr(tmp, "origin_regex") <- "country.name.en.regex"
attr(tmp, "valid_origin") <- "country.name.en.regex"

saveRDS(tmp, here("data/custom_dictionaries/data_exiobase3.rds"))


================================================
FILE: data/custom_dictionaries/get_global_burden_of_disease.R
================================================
source(here("dictionary/utilities.R"))

tmp <- read.csv(here("data/custom_dictionaries/data_global_burden_of_disease.csv")) |>
    unique() |>
    transform(country.name.en.regex = countrycode(country.name, "country.name", "country.name.en.regex")) |>
    select(country.name,
           country.name.en.regex,
           gbd.region = gbd_region,
           gbd.superregion = gbd_superregion)

attr(tmp, "origin_regex") <- "country.name.en.regex"
attr(tmp, "valid_origin") <- "country.name.en.regex"

saveRDS(tmp, here("data/custom_dictionaries/data_global_burden_of_disease.rds"))

================================================
FILE: data/custom_dictionaries/get_gtap.R
================================================
source(here::here("dictionary/utilities.R"))

gtap_versions <- 6:11

## #' Scrap country mapping for GTAP
## #' @param gtap_main integer indicating main GTAP version
## #' @param gtap_final integer with values 1 for pre-release and 2 (default) for
## #' final release
## #' @param gtap_minor integer indicating GTAP minor version (default to 1)
## #' @param gtap_rc integer indicating GTAP release candidate (default to 1)
## #' @return a data.frame with the mapping
## get_gtap_mapping <- function(gtap_main, gtap_final = 2, gtap_minor = 1,
##                              gtap_rc = 1) {
##   gtap_version <- str_glue("{gtap_main}.{gtap_final}{gtap_minor}{gtap_rc}")

##   url <-
##     urltools::param_set(
##       "https://www.gtap.agecon.purdue.edu/databases/regions.aspx",
##       "version", gtap_version
##     )

##   gtap <-
##     read_html(x = url) |>
##     html_element(css = "table#Regions") |>
##     html_table() |>
##     separate_rows(
##       Description,
##       sep = " - "
##     ) |>
##     rename(
##       gtap_num = Number,
##       gtap_code = Code,
##       country = Description
##     ) |>
##     mutate(gtap_name = country[1], .by = gtap_num) |>
##     distinct() |>
##     filter(!(substr(gtap_code, start = 1, stop = 1) == "X" &
##                country == gtap_name)) |>
##     mutate(
##       country = countrycode(country,
##                             origin = "country.name",
##                             destination = "country.name",
##                             warn = FALSE),
##       .keep = "unused"
##     ) |>
##     select(country, gtap_num, gtap_code, gtap_name)

##   return(gtap)
## }

## gtap_versions |>
##   walk(\(version)
##        get_gtap_mapping(version) |>
##          write_csv(
##            here(str_glue("data/custom_dictionaries/data_gtap{version}.csv"))
##          )
##       )

# Convert to RDS dictionary with attributes
gtap_versions |>
  walk(function(version) {
    tmp <-
      read.csv(
        here(str_glue("data/custom_dictionaries/data_gtap{version}.csv"))
      ) |>
      unique() |>
      transform(
        country.name.en.regex = countrycode(
          country,
          "country.name",
          "country.name.en.regex"
        )) |>
      select(country.name = country,
             country.name.en.regex,
             gtap.name = gtap_name,
             gtap.num = gtap_num,
             gtap.cha = gtap_code)
    attr(tmp, "origin_regex") <- "country.name.en.regex"
    attr(tmp, "valid_origin") <- "country.name.en.regex"

    saveRDS(tmp,
            here(str_glue("data/custom_dictionaries/data_gtap{version}.rds")))
  })


================================================
FILE: data/custom_dictionaries/get_us_states.R
================================================
source(here("dictionary/utilities.R"))

tmp <- read.csv(here("data/custom_dictionaries/data_us_states.csv")) |>
    unique() |>
    select(state.name = state,
           state.abb = abbreviation,
           state.regex = state.regex)

attr(tmp, "origin_regex") <- "state.regex"
attr(tmp, "valid_origin") <- c("state.name", "state.abb", "state.regex")

saveRDS(tmp, here("data/custom_dictionaries/data_us_states.rds"))

================================================
FILE: data/extra/countryhood.csv
================================================
iso3c,country,start_year,year_end,start_event,source
ALA,Aland Islands,1920,,petition de la population locale,https://en.wikipedia.org/wiki/%C3%85land_Islands
ASM,American Samoa,1899,,"Accord entre grande puissance (USA, Allemagne et Nouvelle-Zélande)",https://fr.wikipedia.org/wiki/Samoa_am%C3%A9ricaines
AIA,Anguilla,1982,,,https://fr.wikipedia.org/wiki/Anguilla#L.27autonomie
ATA,Antarctica,1959,,Gel des revendications de souverainetés nationales en 1959,https://fr.wikipedia.org/wiki/Antarctique#Politique
ABW,Aruba,1986,,Accord de séparation des Antilles néerlandaises et non du Pays-Bas,https://fr.wikipedia.org/wiki/Aruba#Histoire
BMU,Bermuda,1968,,"colonisation anglaise officialisée en 1684. L'archipel est devenu britannique en 1707 avec la création de la Grande-Bretagne, British Overseas Territory depuis 1968 (Though Bermuda has been classified as a self-governed colony since 1620, internal self-government was bolstered by the establishment of a formal constitution in 1968, and the introduction of universal adult suffrage)",https://en.wikipedia.org/wiki/History_of_Bermuda#Recent_history
BES,"Bonaire, Sint Eustatius and Saba",2010,,Nouveau statut des Antilles néerlandaises,https://fr.wikipedia.org/wiki/Pays-Bas_carib%C3%A9ens
BVT,Bouvet Island,1927,,"Île non-habité, possession norvégienne par explorateurs, alpiniste et station météo",https://fr.wikipedia.org/wiki/%C3%8Ele_Bouvet
IOT,British Indian Ocean Territory,1965,,Rattache les territoires qui jusqu'à l'indépendance de Maurice lui étais attaché,https://fr.wikipedia.org/wiki/Territoire_britannique_de_l%27oc%C3%A9an_Indien
CYM,Cayman Islands,1962,,Devient colonie de la Couronne séparée de la Jamaique,https://fr.wikipedia.org/wiki/%C3%8Eles_Ca%C3%AFmans
CXR,Christmas Island,1958,,Devient australien après l'occupation Japonnaise,https://fr.wikipedia.org/wiki/%C3%8Ele_Christmas_(Australie)
CCK,Cocos (Keeling) Islands,1984,,Sous le controle australien depuis 1955,https://fr.wikipedia.org/wiki/%C3%8Eles_Cocos
COK,Cook Islands,1965,,Indépendandance de la Nouvelle-Zélande,https://fr.wikipedia.org/wiki/%C3%8Eles_Cook
CUW,Curacao,2010,,État autonome au sein du Royaume des Pays-Bas depuis la dissolution de la fédération des Antilles néerlandaises,https://fr.wikipedia.org/wiki/Cura%C3%A7ao
FLK,Falkland Islands (Malvinas),2002,,"Britannique depuis 1770, territoire britannique d'outre-mer depuis 2002",https://en.wikipedia.org/wiki/Falkland_Islands#History
FRO,Faroe Islands,1948,,,https://en.wikipedia.org/wiki/Faroe_Islands#History
GUF,French Guiana,1946,,Passe du statut de colonie à celui de département d'outre mer,https://fr.wikipedia.org/wiki/Guyane#Histoire
PYF,French Polynesia,1946,,Passe du statut de colonie à celui de département d'outre mer,https://fr.wikipedia.org/wiki/Polyn%C3%A9sie_fran%C3%A7aise#XXe_et_XXIe.C2.A0si.C3.A8cles
ATF,French Southern Territories,1955,,Incorporation entre 1924 et 2007 de nouvelles îles à l'ensembles,https://fr.wikipedia.org/wiki/Terres_australes_et_antarctiques_fran%C3%A7aises
GIB,Gibraltar,1969,,"Possession du Royaume-Uni depuis 1704
Download .txt
gitextract_dg_woieq/

├── .Rbuildignore
├── .github/
│   ├── .gitignore
│   └── workflows/
│       ├── altdoc.yaml
│       ├── lint.yaml
│       ├── r-check.yaml
│       └── revdep.yaml
├── .gitignore
├── .here
├── .scrutin/
│   └── config.toml
├── DESCRIPTION
├── LICENSE
├── Makefile
├── NAMESPACE
├── NEWS.md
├── R/
│   ├── cldr_examples.R
│   ├── codelist.R
│   ├── codelist_panel.R
│   ├── countrycode-package.R
│   ├── countrycode.R
│   ├── countryname.R
│   ├── countryname_dict.R
│   ├── get_dictionary.R
│   └── guess_field.R
├── README.Rmd
├── README.md
├── _pkgdown.yml
├── altdoc/
│   ├── .nojekyll
│   ├── docsify.html
│   ├── docsify.md
│   ├── preamble_man_qmd.yml
│   ├── preamble_vignettes_qmd.yml
│   └── preamble_vignettes_rmd.yml
├── appveyor.yml
├── countrycode.Rproj
├── cran-comments.md
├── data/
│   ├── cldr_examples.rda
│   ├── codelist.rda
│   ├── codelist_panel.rda
│   ├── countryname_dict.rda
│   ├── custom_dictionaries/
│   │   ├── data_ch_cantons.csv
│   │   ├── data_ch_cantons.rds
│   │   ├── data_exiobase3.csv
│   │   ├── data_exiobase3.rds
│   │   ├── data_global_burden_of_disease.csv
│   │   ├── data_global_burden_of_disease.rds
│   │   ├── data_gtap10.csv
│   │   ├── data_gtap10.rds
│   │   ├── data_gtap11.csv
│   │   ├── data_gtap11.rds
│   │   ├── data_gtap6.csv
│   │   ├── data_gtap6.rds
│   │   ├── data_gtap7.csv
│   │   ├── data_gtap7.rds
│   │   ├── data_gtap8.csv
│   │   ├── data_gtap8.rds
│   │   ├── data_gtap9.csv
│   │   ├── data_gtap9.rds
│   │   ├── data_us_states.csv
│   │   ├── data_us_states.rds
│   │   ├── get_ch_cantons.R
│   │   ├── get_exiobase3.R
│   │   ├── get_global_burden_of_disease.R
│   │   ├── get_gtap.R
│   │   └── get_us_states.R
│   └── extra/
│       └── countryhood.csv
├── dictionary/
│   ├── Dockerfile
│   ├── build.R
│   ├── codelist_panel_without_cldr.csv
│   ├── codelist_without_cldr.csv
│   ├── data_aviation.csv
│   ├── data_backup.rds
│   ├── data_cctld.csv
│   ├── data_cldr.csv
│   ├── data_cow.csv
│   ├── data_dhs.csv
│   ├── data_ecb.csv
│   ├── data_eurostat.csv
│   ├── data_fao.csv
│   ├── data_fips.csv
│   ├── data_fips.xls
│   ├── data_genc.csv
│   ├── data_gw.csv
│   ├── data_icao.csv
│   ├── data_imf.csv
│   ├── data_ioc.csv
│   ├── data_iso.csv
│   ├── data_iso4217.csv
│   ├── data_polity4.csv
│   ├── data_polity5.csv
│   ├── data_raw/
│   │   ├── data_small_countries.csv
│   │   ├── data_telephone.csv
│   │   └── data_vdem_v15_march2025.rds
│   ├── data_regex.csv
│   ├── data_regions.csv
│   ├── data_small_countries.csv
│   ├── data_telephone.csv
│   ├── data_un.csv
│   ├── data_un_names.csv
│   ├── data_unhcr.csv
│   ├── data_unicode_symbol.csv
│   ├── data_unpd.csv
│   ├── data_vdem.csv
│   ├── data_world_bank.csv
│   ├── data_world_bank_api.csv
│   ├── data_world_bank_region.csv
│   ├── data_wvs.csv
│   ├── get_cctld.R
│   ├── get_cldr.R
│   ├── get_countryname_dict.R
│   ├── get_cow.R
│   ├── get_dhs.R
│   ├── get_ecb.R
│   ├── get_eurostat.R
│   ├── get_fao.R
│   ├── get_fips.R
│   ├── get_genc.R
│   ├── get_gw.R
│   ├── get_ioc.R
│   ├── get_iso.R
│   ├── get_iso4217.R
│   ├── get_polity4.R
│   ├── get_polity5.R
│   ├── get_small_countries.R
│   ├── get_telephone.R
│   ├── get_un.R
│   ├── get_un_names.R
│   ├── get_unhcr.R
│   ├── get_unicode_symbol.R
│   ├── get_vdem.R
│   ├── get_world_bank.R
│   ├── get_world_bank_api.R
│   ├── get_world_bank_region.R
│   ├── get_wvs.R
│   └── utilities.R
├── inst/
│   └── CITATION
├── joss/
│   ├── paper.bib
│   └── paper.md
├── man/
│   ├── cldr_examples.Rd
│   ├── codelist.Rd
│   ├── codelist_panel.Rd
│   ├── countrycode.Rd
│   ├── countryname.Rd
│   ├── countryname_dict.Rd
│   ├── get_dictionary.Rd
│   └── guess_field.Rd
├── tests/
│   ├── test-all.R
│   └── testthat/
│       ├── data-known-name-variations.R
│       ├── test-basic.R
│       ├── test-codelist.R
│       ├── test-corner-cases.R
│       ├── test-countryname.R
│       ├── test-custom-dictionary.R
│       ├── test-destination-only.R
│       ├── test-destination.R
│       ├── test-dictionary_attributes.R
│       ├── test-known-name-variations.R
│       ├── test-nomatch.R
│       ├── test-regex-external.R
│       ├── test-regex-internal.R
│       ├── test-regex-sentence.R
│       ├── test-regex-special.R
│       └── test-unicode-symbols.R
└── vignettes/
    ├── contributions.qmd
    ├── countrycode.qmd
    ├── countryname.qmd
    └── custom.qmd
Condensed preview — 166 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (5,605K chars).
[
  {
    "path": ".Rbuildignore",
    "chars": 367,
    "preview": "cran-comments.md\ndata/backup.rds\ndata/dictionary_static.csv\ndata/extra\ndata/custom_dictionaries\nREADME.md\nLICENSE*\njoss\n"
  },
  {
    "path": ".github/.gitignore",
    "chars": 7,
    "preview": "*.html\n"
  },
  {
    "path": ".github/workflows/altdoc.yaml",
    "chars": 1522,
    "preview": "# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples\n# Need help debugging build failures? Start at"
  },
  {
    "path": ".github/workflows/lint.yaml",
    "chars": 767,
    "preview": "# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples\n# Need help debugging build failures? Start at"
  },
  {
    "path": ".github/workflows/r-check.yaml",
    "chars": 832,
    "preview": "on:\n  push:\n    branches: [main, master]\n  pull_request:\n\nname: scrutin\n\npermissions: read-all\n\njobs:\n  check:\n    runs-"
  },
  {
    "path": ".github/workflows/revdep.yaml",
    "chars": 7640,
    "preview": "# This workflow creates many jobs, run only when a branch is created\non:\n  push:\n    branches:\n      - \"revdep*\" # never"
  },
  {
    "path": ".gitignore",
    "chars": 191,
    "preview": ".Rproj.user\n.Rhistory\n.RData\n.Ruserdata\n*.DS_Store\nREADME.html\naltdoc/freeze.rds\n_quarto/\n!_quarto/_freeze/\ndocs/\n\n# scr"
  },
  {
    "path": ".here",
    "chars": 0,
    "preview": ""
  },
  {
    "path": ".scrutin/config.toml",
    "chars": 18443,
    "preview": "# scrutin configuration\n#\n# scrutin is configured via .scrutin/config.toml in the project root. Fallback:\n# ~/.config/sc"
  },
  {
    "path": "DESCRIPTION",
    "chars": 1588,
    "preview": "Type: Package\nPackage: countrycode\nTitle: Convert Country Names and Country Codes\nVersion: 1.8.0\nAuthors@R: \n    c(perso"
  },
  {
    "path": "LICENSE",
    "chars": 35147,
    "preview": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free "
  },
  {
    "path": "Makefile",
    "chars": 800,
    "preview": ".PHONY: help website dictionary\n\nhelp:  ## Display this help screen\n\t@echo -e \"\\033[1mAvailable commands:\\033[0m\\n\"\n\t@gr"
  },
  {
    "path": "NAMESPACE",
    "chars": 129,
    "preview": "# Generated by roxygen2: do not edit by hand\n\nexport(countrycode)\nexport(countryname)\nexport(get_dictionary)\nexport(gues"
  },
  {
    "path": "NEWS.md",
    "chars": 8543,
    "preview": "# News\n\n## 1.8.0\n\n* New Spanish regular expressions and names: `country.name.es`, `cldr.name.es` and `country.name.es`. "
  },
  {
    "path": "R/cldr_examples.R",
    "chars": 291,
    "preview": "#' List of CLDR country name codes and associated examples\n#'\n#' \\itemize{\n#'   \\item Code: CLDR code\n#'   \\item Example"
  },
  {
    "path": "R/codelist.R",
    "chars": 4925,
    "preview": "#' Country Code Translation Data Frame (Cross-Sectional)\n#'\n#' A data frame used internally by the [countrycode()] funct"
  },
  {
    "path": "R/codelist_panel.R",
    "chars": 262,
    "preview": "#' Country Code Translation Data Frame (Country-Year Panel)\n#'\n#' A panel of country-year observations with various code"
  },
  {
    "path": "R/countrycode-package.R",
    "chars": 868,
    "preview": "#' Convert country codes or country names\n#'\n#' The \\code{countrycode} function can convert to and from several differen"
  },
  {
    "path": "R/countrycode.R",
    "chars": 17924,
    "preview": "#' Convert Country Codes\n#'\n#' Converts long country names into one of many different coding schemes.\n#' Translates from"
  },
  {
    "path": "R/countryname.R",
    "chars": 2548,
    "preview": "#' Convert country names in any language to another name or code\n#'\n#' Converts long country names in any language to on"
  },
  {
    "path": "R/countryname_dict.R",
    "chars": 207,
    "preview": "#' A dataframe of alternative country names in many languages. Used internally by\n#' the `countryname` function.\n#'\n#' @"
  },
  {
    "path": "R/get_dictionary.R",
    "chars": 1593,
    "preview": "#' Get Custom Dictionaries\n#' \n#' Download a custom dictionary to use in the `custom_dict` argument of `countrycode()`\n#"
  },
  {
    "path": "R/guess_field.R",
    "chars": 1626,
    "preview": "#' Guess the code/name of a vector\n#'\n#' Users sometimes do not know what kind of code or field their data contain.\n#' T"
  },
  {
    "path": "README.Rmd",
    "chars": 3352,
    "preview": "---\noutput: github_document\n---\n\n<p align=\"center\">\n<img src=\"https://user-images.githubusercontent.com/987058/167296405"
  },
  {
    "path": "README.md",
    "chars": 3333,
    "preview": "\n<p align=\"center\">\n\n<img src=\"https://user-images.githubusercontent.com/987058/167296405-e7798ac8-03e7-444e-acaf-d99fc4"
  },
  {
    "path": "_pkgdown.yml",
    "chars": 45,
    "preview": "template:\n  params:\n    bootswatch: readable\n"
  },
  {
    "path": "altdoc/.nojekyll",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "altdoc/docsify.html",
    "chars": 1425,
    "preview": "<!-- index.html -->\n\n<!DOCTYPE html>\n<html>\n<head>\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\">\n  <m"
  },
  {
    "path": "altdoc/docsify.md",
    "chars": 268,
    "preview": "* [Home](/)\n* Articles: $ALTDOC_VIGNETTE_BLOCK\n* Reference: $ALTDOC_MAN_BLOCK\n* [News]($ALTDOC_NEWS)\n* [Changelog]($ALTD"
  },
  {
    "path": "altdoc/preamble_man_qmd.yml",
    "chars": 45,
    "preview": "---\nformat:\n  md:\n    prefer-html: true\n---\n\n"
  },
  {
    "path": "altdoc/preamble_vignettes_qmd.yml",
    "chars": 72,
    "preview": "---\nformat:\n  md:\n    prefer_html: true\ndefault-image-extension: \"\"\n---\n"
  },
  {
    "path": "altdoc/preamble_vignettes_rmd.yml",
    "chars": 32,
    "preview": "---\nalways_allow_html: yes\n---\n\n"
  },
  {
    "path": "appveyor.yml",
    "chars": 1085,
    "preview": "# DO NOT CHANGE the \"init\" and \"install\" sections below\n\n# Download script file from GitHub\ninit:\n  ps: |\n        $Error"
  },
  {
    "path": "countrycode.Rproj",
    "chars": 396,
    "preview": "Version: 1.0\n\nRestoreWorkspace: Default\nSaveWorkspace: Default\nAlwaysSaveHistory: Default\n\nEnableCodeIndexing: Yes\nUseSp"
  },
  {
    "path": "cran-comments.md",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "data/custom_dictionaries/data_ch_cantons.csv",
    "chars": 2183,
    "preview": "fso.number,abbreviation,canton.name,canton.name.regex,canton.name.de,canton.name.fr,canton.name.it,canton.name.rm\n1,ZH,Z"
  },
  {
    "path": "data/custom_dictionaries/data_exiobase3.csv",
    "chars": 4183,
    "preview": "country,exiobase_code,exiobase_num\nAfghanistan,WA,45\nAlbania,WE,47\nAlgeria,WF,48\nAmerican Samoa,WA,45\nAndorra,WE,47\nAngo"
  },
  {
    "path": "data/custom_dictionaries/data_global_burden_of_disease.csv",
    "chars": 11933,
    "preview": "iso3c,country.name,gbd_region,gbd_superregion\nCHN,China,East Asia,\"Southeast Asia, East Asia, and Oceania\"\nPRK,North Kor"
  },
  {
    "path": "data/custom_dictionaries/data_gtap10.csv",
    "chars": 8008,
    "preview": "country,gtap_num,gtap_code,gtap_name\nAustralia,1,AUS,Australia\nChristmas Island,1,AUS,Australia\nCocos (Keeling) Islands,"
  },
  {
    "path": "data/custom_dictionaries/data_gtap11.csv",
    "chars": 8085,
    "preview": "country,gtap_num,gtap_code,gtap_name\nAustralia,1,AUS,Australia\nChristmas Island,1,AUS,Australia\nCocos (Keeling) Islands,"
  },
  {
    "path": "data/custom_dictionaries/data_gtap6.csv",
    "chars": 8463,
    "preview": "country,gtap_num,gtap_code,gtap_name\nAustralia,1,AUS,Australia\nNew Zealand,2,NZL,New Zealand\nAmerican Samoa,3,XOC,Rest o"
  },
  {
    "path": "data/custom_dictionaries/data_gtap7.csv",
    "chars": 7605,
    "preview": "country,gtap_num,gtap_code,gtap_name\nAustralia,1,AUS,Australia\nNew Zealand,2,NZL,New Zealand\nAmerican Samoa,3,XOC,Rest o"
  },
  {
    "path": "data/custom_dictionaries/data_gtap8.csv",
    "chars": 8127,
    "preview": "country,gtap_num,gtap_code,gtap_name\nAustralia,1,AUS,Australia\nChristmas Island,1,AUS,Australia\nCocos (Keeling) Islands,"
  },
  {
    "path": "data/custom_dictionaries/data_gtap9.csv",
    "chars": 8027,
    "preview": "country,gtap_num,gtap_code,gtap_name\nAustralia,1,AUS,Australia\nChristmas Island,1,AUS,Australia\nCocos (Keeling) Islands,"
  },
  {
    "path": "data/custom_dictionaries/data_us_states.csv",
    "chars": 1661,
    "preview": "\"state\",\"abbreviation\",\"state.regex\"\n\"Alabama\",\"AL\",\".*alabama.*\"\n\"Alaska\",\"AK\",\".*alaska.*\"\n\"Arizona\",\"AZ\",\".*arizona.*"
  },
  {
    "path": "data/custom_dictionaries/get_ch_cantons.R",
    "chars": 333,
    "preview": "source(here::here(\"dictionary/utilities.R\"))\n\ntmp <- read.csv(here(\"data/custom_dictionaries/data_ch_cantons.csv\")) |>\n "
  },
  {
    "path": "data/custom_dictionaries/get_exiobase3.R",
    "chars": 1720,
    "preview": "source(here::here(\"dictionary/utilities.R\"))\n\n# This file cannot run automatically because the original files cannot be\n"
  },
  {
    "path": "data/custom_dictionaries/get_global_burden_of_disease.R",
    "chars": 581,
    "preview": "source(here(\"dictionary/utilities.R\"))\n\ntmp <- read.csv(here(\"data/custom_dictionaries/data_global_burden_of_disease.csv"
  },
  {
    "path": "data/custom_dictionaries/get_gtap.R",
    "chars": 2621,
    "preview": "source(here::here(\"dictionary/utilities.R\"))\n\ngtap_versions <- 6:11\n\n## #' Scrap country mapping for GTAP\n## #' @param g"
  },
  {
    "path": "data/custom_dictionaries/get_us_states.R",
    "chars": 417,
    "preview": "source(here(\"dictionary/utilities.R\"))\n\ntmp <- read.csv(here(\"data/custom_dictionaries/data_us_states.csv\")) |>\n    uniq"
  },
  {
    "path": "data/extra/countryhood.csv",
    "chars": 11350,
    "preview": "iso3c,country,start_year,year_end,start_event,source\nALA,Aland Islands,1920,,petition de la population locale,https://en"
  },
  {
    "path": "dictionary/Dockerfile",
    "chars": 604,
    "preview": "# sudo docker build -t countryyear -f code/Dockerfile .\n# docker run -ti --rm -v \"$PWD\":/home/docker -w /home/docker -u "
  },
  {
    "path": "dictionary/build.R",
    "chars": 5474,
    "preview": "setwd(here::here())\nsource('dictionary/utilities.R')\n\n\n##################\n#  availability  #\n##################\n\nscraper"
  },
  {
    "path": "dictionary/codelist_without_cldr.csv",
    "chars": 140004,
    "preview": "ar5,cctld,continent,country.name.de,country.name.de.regex,country.name.en,country.name.en.regex,country.name.es,country."
  },
  {
    "path": "dictionary/data_aviation.csv",
    "chars": 10597,
    "preview": "country,ar5,eurocontrol_statfor,eurocontrol_pru\nAfghanistan,ASIA,Asia/Pacific,Asia\nÅland Islands,OECD1990,ECAC North-Eas"
  },
  {
    "path": "dictionary/data_cctld.csv",
    "chars": 3757,
    "preview": "country,cctld\nAndorra,.ad\nUnited Arab Emirates,.ae\nAfghanistan,.af\nAntigua & Barbuda,.ag\nAnguilla,.ai\nAlbania,.al\nArmeni"
  },
  {
    "path": "dictionary/data_cldr.csv",
    "chars": 1415836,
    "preview": "cldr.name.af,cldr.name.agq,cldr.name.ak,cldr.name.am,cldr.name.ar,cldr.name.ar_ly,cldr.name.ar_sa,cldr.name.as,cldr.name"
  },
  {
    "path": "dictionary/data_cow.csv",
    "chars": 506970,
    "preview": "country,cowc,cown,cow.name,year\nUnited States of America,USA,2,United States of America,1816\nUnited States of America,US"
  },
  {
    "path": "dictionary/data_dhs.csv",
    "chars": 1177,
    "preview": "country,dhs\nAfghanistan,AF\nAlbania,AL\nAngola,AO\nArmenia,AM\nAzerbaijan,AZ\nBangladesh,BD\nBenin,BJ\nBolivia,BO\nBotswana,BT\nB"
  },
  {
    "path": "dictionary/data_ecb.csv",
    "chars": 3866,
    "preview": "country,ecb\nAndorra,AD\nUnited Arab Emirates,AE\nAfghanistan,AF\nAntigua and Barbuda,AG\nAnguilla,AI\nAlbania,AL\nArmenia,AM\nN"
  },
  {
    "path": "dictionary/data_eurostat.csv",
    "chars": 3547,
    "preview": "eurostat,country\nAD,Andorra\nAE,United Arab Emirates\nAF,Afghanistan\nAG,Antigua and Barbuda\nAI,Anguilla\nAL,Albania\nAM,Arme"
  },
  {
    "path": "dictionary/data_fao.csv",
    "chars": 5007,
    "preview": "country,fao,gaul\nBelarus,57,26\nCambodia,115,44\nAlgeria,4,4\nCameroon,32,45\nCanada,33,46\nCabo Verde,35,47\nIran (Islamic Re"
  },
  {
    "path": "dictionary/data_fips.csv",
    "chars": 3436,
    "preview": "fips,country\nAF,AFGHANISTAN\nAL,ALBANIA\nAG,ALGERIA\nAQ,AMERICAN SAMOA\nAN,ANDORRA\nAO,ANGOLA\nAV,ANGUILLA\nAY,ANTARCTICA\nAC,AN"
  },
  {
    "path": "dictionary/data_genc.csv",
    "chars": 5441,
    "preview": "country,genc2c,genc3c,genc3n\nAFGHANISTAN,AF,AFG,004\nALBANIA,AL,ALB,008\nALGERIA,DZ,DZA,012\nAMERICAN SAMOA,AS,ASM,016\nANDO"
  },
  {
    "path": "dictionary/data_gw.csv",
    "chars": 408596,
    "preview": "gwn,gwc,country,year\n2,USA,United States of America,1816\n2,USA,United States of America,1817\n2,USA,United States of Amer"
  },
  {
    "path": "dictionary/data_icao.csv",
    "chars": 3330,
    "preview": "icao.region,country\nAFI,Angola\nAFI,Benin\nAFI,Botswana\nAFI,Burkina Faso\nAFI,Burundi\nAFI,Cameroon\nAFI,Cape Verde\nAFI,Centr"
  },
  {
    "path": "dictionary/data_imf.csv",
    "chars": 3419,
    "preview": "country,imf\nAfghanistan,512\nAlbania,914\nAlgeria,612\nAmerican Samoa,859\nAngola,614\nAnguilla,312\nAntigua and Barbuda,311\nA"
  },
  {
    "path": "dictionary/data_ioc.csv",
    "chars": 3075,
    "preview": "country,ioc\nAfghanistan,AFG\nAlbania,ALB\nAlgeria,ALG\nAmerican Samoa,ASA\nAndorra,AND\nAngola,ANG\nAntigua and Barbuda,ANT\nAr"
  },
  {
    "path": "dictionary/data_iso.csv",
    "chars": 13340,
    "preview": "iso.name.en,iso.name.fr,iso2c,iso3c,iso3n,country\nAfghanistan,Afghanistan (l'),AF,AFG,4,Afghanistan\nAlbania,Albanie (l')"
  },
  {
    "path": "dictionary/data_iso4217.csv",
    "chars": 7613,
    "preview": "country,currency,iso4217c,iso4217n\nAfghanistan,Afghani,AFN,971\nÅland Islands,Euro,EUR,978\nAlbania,Lek,ALL,8\nAlgeria,Alge"
  },
  {
    "path": "dictionary/data_polity4.csv",
    "chars": 521347,
    "preview": "p4n,p4c,p4.name,year,country\n700,AFG,Afghanistan,1800,Afghanistan\n700,AFG,Afghanistan,1801,Afghanistan\n700,AFG,Afghanist"
  },
  {
    "path": "dictionary/data_polity5.csv",
    "chars": 381804,
    "preview": "p5n,p5c,country,year\n700,AFG,Afghanistan,1800\n700,AFG,Afghanistan,1801\n700,AFG,Afghanistan,1802\n700,AFG,Afghanistan,1803"
  },
  {
    "path": "dictionary/data_raw/data_small_countries.csv",
    "chars": 11438,
    "preview": "iso3c,country,start,end,event,source\nABW,Aruba,1986,,Accord de séparation des Antilles néerlandaises et non du Pays-Bas,"
  },
  {
    "path": "dictionary/data_raw/data_telephone.csv",
    "chars": 5889,
    "preview": "country.name,telephone\nAmerican Samoa,1\nAnguilla,1\nAntigua and Barbuda,1\nBahamas (Commonwealth of the),1\nBarbados,1\nBerm"
  },
  {
    "path": "dictionary/data_regex.csv",
    "chars": 45576,
    "preview": "country.name.de,country.name.de.regex,country.name.en,country.name.en.regex,country.name.fr,country.name.fr.regex,countr"
  },
  {
    "path": "dictionary/data_regions.csv",
    "chars": 9010,
    "preview": "country,continent,eu28,region23\nAfghanistan,Asia,\"\",Southern Asia\nÅland Islands,Europe,\"\",Northern Europe\nAlbania,Europe"
  },
  {
    "path": "dictionary/data_small_countries.csv",
    "chars": 74536,
    "preview": "country,year\nAruba,1986\nAruba,1987\nAruba,1988\nAruba,1989\nAruba,1990\nAruba,1991\nAruba,1992\nAruba,1993\nAruba,1994\nAruba,19"
  },
  {
    "path": "dictionary/data_telephone.csv",
    "chars": 5728,
    "preview": "country,telephone\nAfghanistan,93\nAlbania (Republic of),355\nAlgeria (People's Democratic Republic of),213\nAmerican Samoa,"
  },
  {
    "path": "dictionary/data_un.csv",
    "chars": 14442,
    "preview": "country,un,un.region.name,un.region.code,un.regionsub.name,un.regionsub.code,un.regionintermediate.name,un.regioninterme"
  },
  {
    "path": "dictionary/data_un_names.csv",
    "chars": 13811,
    "preview": "un.name.en,un.name.fr,un.name.es,un.name.ru,un.name.zh,un.name.ar,country\nAfghanistan,Afghanistan,Afganistán,Афганистан,"
  },
  {
    "path": "dictionary/data_unhcr.csv",
    "chars": 7379,
    "preview": "country,unhcr,unhcr.region\nAfghanistan,AFG,Asia and the Pacific\nAlbania,ALB,Europe\nAlgeria,ALG,Middle East and North Afr"
  },
  {
    "path": "dictionary/data_unicode_symbol.csv",
    "chars": 4008,
    "preview": "unicode.symbol,country\n🇦🇫,Afghanistan\n🇦🇱,Albania\n🇩🇿,Algeria\n🇦🇸,American Samoa\n🇦🇩,Andorra\n🇦🇴,Angola\n🇦🇮,Anguilla\n🇦🇶,Antarc"
  },
  {
    "path": "dictionary/data_unpd.csv",
    "chars": 3507,
    "preview": "country,unpd\nAfghanistan,4\nAlbania,8\nAlgeria,12\nAmerican Samoa,16\nAndorra,20\nAngola,24\nAnguilla,660\nAntigua and Barbuda,"
  },
  {
    "path": "dictionary/data_vdem.csv",
    "chars": 761190,
    "preview": "country,vdem.name,vdem,year\nAfghanistan,Afghanistan,36,1789\nAfghanistan,Afghanistan,36,1790\nAfghanistan,Afghanistan,36,1"
  },
  {
    "path": "dictionary/data_world_bank.csv",
    "chars": 3240,
    "preview": "country,wb\nAfghanistan,AFG\nAlbania,ALB\nAlgeria,DZA\nAmerican Samoa,ASM\nAndorra,AND\nAngola,AGO\nAntigua and Barbuda,ATG\nArg"
  },
  {
    "path": "dictionary/data_world_bank_api.csv",
    "chars": 3898,
    "preview": "country,wb_api2c,wb_api3c\nAruba,AW,ABW\nAfghanistan,AF,AFG\nAngola,AO,AGO\nAlbania,AL,ALB\nAndorra,AD,AND\nUnited Arab Emirat"
  },
  {
    "path": "dictionary/data_world_bank_region.csv",
    "chars": 9223,
    "preview": "country,region\nAndorra,Europe & Central Asia\nUnited Arab Emirates,Middle East & North Africa\nAfghanistan,South Asia\nAnti"
  },
  {
    "path": "dictionary/data_wvs.csv",
    "chars": 2280,
    "preview": "wvs,country\n4,Afghanistan\n8,Albania\n12,Algeria\n16,American Samoa\n20,Andorra\n24,Angola\n28,Antigua\n31,Azerbaijan\n32,Argent"
  },
  {
    "path": "dictionary/get_cctld.R",
    "chars": 1760,
    "preview": "library(xml2)\nlibrary(rvest)\nlibrary(purrr)\nlibrary(dplyr)\nlibrary(countrycode)\nlibrary(readr)\n\nurl <- 'https://www.iana"
  },
  {
    "path": "dictionary/get_cldr.R",
    "chars": 3306,
    "preview": "source(here::here('dictionary/utilities.R'))\n\n# This script will get the most recently released version of the CLDR full"
  },
  {
    "path": "dictionary/get_countryname_dict.R",
    "chars": 2240,
    "preview": "source(here::here('dictionary/utilities.R'))\n\nclean_string <- function(x) {\n    out <- x %>%\n           str_remove_all(\""
  },
  {
    "path": "dictionary/get_cow.R",
    "chars": 883,
    "preview": "source(here::here('dictionary/utilities.R'))\n\nget_file <- function(web) {\n    tmp <- tempfile()\n    download.file(web, t"
  },
  {
    "path": "dictionary/get_dhs.R",
    "chars": 334,
    "preview": "source(here::here('dictionary/utilities.R'))\n\nurl <- 'https://api.dhsprogram.com/rest/dhs/countries?select=DHS_CountryCo"
  },
  {
    "path": "dictionary/get_ecb.R",
    "chars": 945,
    "preview": "source(here::here('dictionary/utilities.R'))\n\nbad <- c(\"Gaza and Jericho\") # Collides with State of Palestine\n\nurl <- 'h"
  },
  {
    "path": "dictionary/get_eurostat.R",
    "chars": 1577,
    "preview": "source(here::here('dictionary/utilities.R'))\n\ntmp = tempfile()\nurl = 'https://ec.europa.eu/eurostat/api/dissemination/sd"
  },
  {
    "path": "dictionary/get_fao.R",
    "chars": 1860,
    "preview": "source(here::here(\"dictionary/utilities.R\"))\n\nurl <- 'http://www.fao.org/fileadmin/user_upload/countryprofiles/Excel/All"
  },
  {
    "path": "dictionary/get_fips.R",
    "chars": 1036,
    "preview": "source(here::here('dictionary/utilities.R'))\n\nurl <- 'https://web.archive.org/web/20161214044235/http://geonames.nga.mil"
  },
  {
    "path": "dictionary/get_genc.R",
    "chars": 1764,
    "preview": "source(here::here(\"dictionary/utilities.R\"))\n\n# Check https://geonames.nga.mil/gns/html/countrycodes.html quarterly for "
  },
  {
    "path": "dictionary/get_gw.R",
    "chars": 1448,
    "preview": "source(here::here('dictionary/utilities.R'))\n\nurl <- \"http://ksgleditsch.com/data/iisystem.dat\"\n\ngw <- readr::read_tsv(u"
  },
  {
    "path": "dictionary/get_ioc.R",
    "chars": 906,
    "preview": "source(here::here('dictionary/utilities.R'))\n\nurl = 'https://stillmed.olympics.com/media/Document%20Library/OlympicOrg/D"
  },
  {
    "path": "dictionary/get_iso.R",
    "chars": 1054,
    "preview": "###################################\n#  this function no longer works  #\n#  but code may be reusable       #\n############"
  },
  {
    "path": "dictionary/get_iso4217.R",
    "chars": 1731,
    "preview": "source(here::here('dictionary/utilities.R'))\n\nurl <- 'https://www.six-group.com/dam/download/financial-information/data-"
  },
  {
    "path": "dictionary/get_polity4.R",
    "chars": 1113,
    "preview": "source(here::here('dictionary/utilities.R'))\n\nurl <- 'http://www.systemicpeace.org/inscr/p4v2015.xls'\n\ndownload.file(url"
  },
  {
    "path": "dictionary/get_polity5.R",
    "chars": 1071,
    "preview": "source(here::here('dictionary/utilities.R'))\n\nurl <- 'http://www.systemicpeace.org/inscr/p5v2018.xls'\n\ndownload.file(url"
  },
  {
    "path": "dictionary/get_small_countries.R",
    "chars": 629,
    "preview": "source(here::here('dictionary/utilities.R'))\n\n# small countries not covered by V-Dem, CoW, or Polity\n# manually collecte"
  },
  {
    "path": "dictionary/get_telephone.R",
    "chars": 1328,
    "preview": "source(here::here('dictionary/utilities.R'))\n\n# ITU-T E.164 country codes for telecommunication\n# Source: https://www.it"
  },
  {
    "path": "dictionary/get_un.R",
    "chars": 754,
    "preview": "source(here::here('dictionary/utilities.R'))\n\nurl <- 'https://unstats.un.org/unsd/methodology/m49/overview/'\nselector <-"
  },
  {
    "path": "dictionary/get_un_names.R",
    "chars": 10192,
    "preview": "# This script will scrape the UN website for official country names in the six\n# official languages of the United Nation"
  },
  {
    "path": "dictionary/get_unhcr.R",
    "chars": 1235,
    "preview": "library(tidyverse)\n\nunhcr_by_region <-\n  jsonlite::fromJSON(\"https://api.unhcr.org/population/v1/regions\")$items |>\n  tr"
  },
  {
    "path": "dictionary/get_unicode_symbol.R",
    "chars": 4154,
    "preview": "require(dplyr)\nrequire(tibble)\nrequire(purrr)\nrequire(stringr)\nrequire(httr)\nrequire(xml2)\nrequire(assertthat)\n\n# This s"
  },
  {
    "path": "dictionary/get_vdem.R",
    "chars": 1018,
    "preview": "source(here::here('dictionary/utilities.R'))\n\n# readRDS(\"~/countrycode/dictionary/data_raw/V-Dem-CY-Core-v15.rds\") %>%\n#"
  },
  {
    "path": "dictionary/get_world_bank.R",
    "chars": 1805,
    "preview": "source(here::here('dictionary/utilities.R'))\n\nurl <- 'https://databankfiles.worldbank.org/public/ddpext_download/site-co"
  },
  {
    "path": "dictionary/get_world_bank_api.R",
    "chars": 432,
    "preview": "source(here::here('dictionary/utilities.R'))\n\ntmp <- tempfile(fileext = '.json')\nurl <- 'http://api.worldbank.org/V2/en/"
  },
  {
    "path": "dictionary/get_world_bank_region.R",
    "chars": 5769,
    "preview": "source(here::here('dictionary/utilities.R'))\n\nautomatic <- WDI(country = \"all\", start = 2016, end = 2016, extra = TRUE) "
  },
  {
    "path": "dictionary/get_wvs.R",
    "chars": 1511,
    "preview": "source(here::here('dictionary/utilities.R'))\n\nsink('/dev/null') # hack to suppress irritating/uninformative messages\nhtt"
  },
  {
    "path": "dictionary/utilities.R",
    "chars": 2631,
    "preview": "###########\n#  setup  #\n###########\npkgs <- c(\n  \"here\",\n  \"conflicted\",\n  \"janitor\",\n  \"readxl\",\n  \"utf8\",\n  \"xml2\",\n  "
  },
  {
    "path": "inst/CITATION",
    "chars": 965,
    "preview": "citHeader(\"To cite countrycode in publications use:\")\n\nbibentry(bibtype = \"Article\",\n  title        = \"countrycode: An R"
  },
  {
    "path": "joss/paper.bib",
    "chars": 1134,
    "preview": "@Manual{Coe2018,\ntitle = {datamaps: Create Interactive Web Maps with the 'JavaScript Datamaps' Library},\nauthor = {John "
  },
  {
    "path": "joss/paper.md",
    "chars": 2916,
    "preview": "---\ntitle: 'countrycode: An R package to convert country names and country codes'\ntags:\n  - R\n  - CRAN\n  - social scienc"
  },
  {
    "path": "man/cldr_examples.Rd",
    "chars": 397,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/cldr_examples.R\n\\docType{data}\n\\name{cldr_"
  },
  {
    "path": "man/codelist.Rd",
    "chars": 5434,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/codelist.R\n\\docType{data}\n\\name{codelist}\n"
  },
  {
    "path": "man/codelist_panel.Rd",
    "chars": 380,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/codelist_panel.R\n\\docType{data}\n\\name{code"
  },
  {
    "path": "man/countrycode.Rd",
    "chars": 4855,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/countrycode.R\n\\name{countrycode}\n\\alias{co"
  },
  {
    "path": "man/countryname.Rd",
    "chars": 1935,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/countryname.R\n\\name{countryname}\n\\alias{co"
  },
  {
    "path": "man/countryname_dict.Rd",
    "chars": 449,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/countryname_dict.R\n\\docType{data}\n\\name{co"
  },
  {
    "path": "man/get_dictionary.Rd",
    "chars": 972,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/get_dictionary.R\n\\name{get_dictionary}\n\\al"
  },
  {
    "path": "man/guess_field.Rd",
    "chars": 902,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/guess_field.R\n\\name{guess_field}\n\\alias{gu"
  },
  {
    "path": "tests/test-all.R",
    "chars": 142,
    "preview": "## Test `countrycode` using the `testthat` package\n\n## Setup\nlibrary(testthat)\n\n## Runs the tests in tests/testthat\ntest"
  },
  {
    "path": "tests/testthat/data-known-name-variations.R",
    "chars": 3785,
    "preview": "variations <- list(\n\n\n  #\"Åland Islands\" = c(\n    #\"Aland Islands\",\n    #\"aland islands\",\n    #\"Åland Islands\",\n    #\"ål"
  },
  {
    "path": "tests/testthat/test-basic.R",
    "chars": 1594,
    "preview": "context('Basic conversions')\n\ntest_that('valid iso3c to country.name works', {\n    name_of <- function(iso3c_code) count"
  },
  {
    "path": "tests/testthat/test-codelist.R",
    "chars": 3919,
    "preview": "\ncs <- countrycode::codelist\npan <- countrycode::codelist_panel\n\ndest <- c('year', 'ar5', 'continent', 'currency', 'eu28"
  },
  {
    "path": "tests/testthat/test-corner-cases.R",
    "chars": 7156,
    "preview": "context('Corner cases')\n\n\ntest_that(\"Issue #258\", {\n    expect_equal(\n        codelist_panel[codelist_panel$country.name"
  },
  {
    "path": "tests/testthat/test-countryname.R",
    "chars": 2392,
    "preview": "context('countryname function')\n\ntest_that('reported bugs', {\n  expect_identical(countryname(\"Federated States of Micron"
  },
  {
    "path": "tests/testthat/test-custom-dictionary.R",
    "chars": 1505,
    "preview": "context('Usage of a custom dictionary')\n\ntest_that('custom dictionary without regex', {\n    test_func <- function(iso3c_"
  },
  {
    "path": "tests/testthat/test-destination-only.R",
    "chars": 545,
    "preview": "context('Destination-only codes')\n\ntest_that('Destination-only codes raise errors when used as origin', {\n    f <- funct"
  },
  {
    "path": "tests/testthat/test-destination.R",
    "chars": 312,
    "preview": "test_that(\"vector of destination codes\", {\n    expect_equal(countrycode(\"Serbia\", \"country.name\", \"iso3c\"), \"SRB\")\n    e"
  },
  {
    "path": "tests/testthat/test-dictionary_attributes.R",
    "chars": 1320,
    "preview": "question <- c(\"Aroba\", \"Canuda\")\nanswer <- c(\"Aruba\", \"Canada\")\n\ntest_that(\"no attributes\", {\n\n  dict <- data.frame(\n   "
  },
  {
    "path": "tests/testthat/test-known-name-variations.R",
    "chars": 518,
    "preview": "context('Known country name variations')\n\nlibrary(utf8)\n\nsource('data-known-name-variations.R')\n\ntest_that('correct matc"
  },
  {
    "path": "tests/testthat/test-nomatch.R",
    "chars": 2263,
    "preview": "context('nomatch argument to fill-in non-matching code')\n\norigin <- c('ALG', 'AUH', 'BAD')\ntest_that('nomatch argument w"
  },
  {
    "path": "tests/testthat/test-regex-external.R",
    "chars": 12278,
    "preview": "context('External validity of regex')\n\niso3c_of <- function(name) countrycode(name, 'country.name', 'iso3c', warn = TRUE"
  },
  {
    "path": "tests/testthat/test-regex-internal.R",
    "chars": 1589,
    "preview": "context('Internal validity of regex')\n\niso3c_of <- function(name) countrycode(name, 'country.name', 'iso3c')\n\ntest_that("
  },
  {
    "path": "tests/testthat/test-regex-sentence.R",
    "chars": 1424,
    "preview": "#context('Use of regexes in sentences')\n\n#f = function(k) gsub('COUNTRY', k, 'The governement of COUNTRY was reelected.'"
  },
  {
    "path": "tests/testthat/test-regex-special.R",
    "chars": 13077,
    "preview": "context('Special cases of regex')\n\niso3c_of <- function(name) countrycode(name, 'country.name', 'iso3c', warn = TRUE)\nno"
  },
  {
    "path": "tests/testthat/test-unicode-symbols.R",
    "chars": 709,
    "preview": "context('Emoji flags')\n\ntest_that('converting to and from emoji works', {\n    expect_equal(countrycode('Antarctica','cou"
  },
  {
    "path": "vignettes/contributions.qmd",
    "chars": 3158,
    "preview": "# Contributions\n\n## Adding a new code\n\nNew country codes are created by two files:\n\n1. `dictionary/get_*.R` is an `R` sc"
  },
  {
    "path": "vignettes/countrycode.qmd",
    "chars": 8492,
    "preview": "# Country codes\n\n## Convert a single name or code\n\nLoad library:\n\n```{r}\nlibrary(countrycode)\n```\n\nConvert single countr"
  },
  {
    "path": "vignettes/countryname.qmd",
    "chars": 313,
    "preview": "# Country names\n\nThe function `countryname` tries to convert country names from any language. For example:\n\n```{r}\nlibra"
  },
  {
    "path": "vignettes/custom.qmd",
    "chars": 1838,
    "preview": "# Custom conversion functions\n\nIt is easy to to create alternative functions with different default arguments and/or dic"
  }
]

// ... and 18 more files (download for full content)

About this extraction

This page contains the full source code of the vincentarelbundock/countrycode GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 166 files (15.3 MB), approximately 1.2M tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!