Skip to content
This repository
Browse code

Added World Bank code

  • Loading branch information...
commit d62b04dc0f7ca6effd8494815f2743a0c79e81aa 1 parent 4e55012
Vincent Arel-Bundock authored
4 DESCRIPTION
@@ -9,10 +9,10 @@ Author: Vincent Arel-Bundock <varel@umich.edu>
9 9 Description: Standardize country names, convert them into one of
10 10 seven coding schemes, convert between coding schemes, and
11 11 assign region descriptors.
12   -Version: 0.7
  12 +Version: 0.8
13 13 URL: http://www.umich.edu/~varel,
14 14 https://github.com/vincentarelbundock/countrycode
15   -Date: 2012-06-01
  15 +Date: 2012-06-26
16 16 Collate:
17 17 'countrycode.R'
18 18 'countrycode-package.R'
21 NEWS
... ... @@ -1,7 +1,16 @@
  1 +Version 0.8 (2012-06-26)
  2 +------------------------
  3 +
  4 +* Added World Bank (wb) country codes. Very similar, but slightly different from iso3c.
  5 +
1 6 Version 0.7 (2012-06-01)
2   - Removed useless functions countrycode.nomatch and countryframe
3   - Fixed 2 Congo-related problems
4   - Added option for countrycode() to report codes for which no match was found
5   - Moved documentation to roxygen2
6   - Fixed Trinidad Tobago regex
7   - Added UN and FAO country codes
  7 +------------------------
  8 +
  9 +* Removed useless functions countrycode.nomatch and countryframe
  10 +* Fixed 2 Congo-related problems
  11 +* Added option for countrycode() to report codes for which no match was found
  12 +* Moved documentation to roxygen2
  13 +* Fixed Trinidad Tobago regex
  14 +* Added UN and FAO country codes
  15 +
  16 +
12 R/countrycode.R
... ... @@ -1,6 +1,6 @@
1 1 #' Convert country codes
2 2 #'
3   -#' Converts long country names into one of 9 different coding schemes.
  3 +#' Converts long country names into one of many different coding schemes.
4 4 #' Translates from one scheme to another. Converts country name or coding
5 5 #' scheme to the official short English country name. Creates a new variable
6 6 #' with the name of the continent or region to which each country belongs.
@@ -12,11 +12,11 @@
12 12 #' @keywords countrycode
13 13 #' @note Supports the following coding schemes: Correlates of War character,
14 14 #' CoW-numeric, ISO3-character, ISO3-numeric, ISO2-character, IMF numeric, FIPS 10-4,
15   -#' FAO numeric, United Nations numeric, official English short country names (ISO),
16   -#' continent, region.
  15 +#' FAO numeric, United Nations numeric, World Bank character,
  16 +#' official English short country names (ISO), continent, region.
17 17 #'
18 18 #' The following strings can be used as arguments for \code{origin} or \code{destination}:
19   -#' "cowc", "cown", "iso3c", "iso3n", "iso2c", "imf", "fips104", "fao", "un", "country.name".
  19 +#' "cowc", "cown", "iso3c", "iso3n", "iso2c", "imf", "fips104", "fao", "un", "wb", "country.name".
20 20 #' The following strings can be used as arguments for \code{destination}
21 21 #' \emph{only}: "continent", "region"
22 22 #' @export
@@ -26,9 +26,9 @@
26 26 #' countrycode(codes.of.origin, "cowc", "iso3c")
27 27 countrycode <- function (sourcevar, origin, destination, warn=FALSE){
28 28 # Sanity check
29   - origin_codes<-c("cowc", "cown", "fips04", "imf", "iso2c", "iso3c", "iso3n", "fao", "un", "country.name")
  29 + origin_codes<-c("cowc", "cown", "fips04", "imf", "iso2c", "iso3c", "iso3n", "fao", "un", "wb", "country.name")
30 30 destination_codes<-c("region", "continent", "cowc", "cown", "fao", "fips04", "imf",
31   - "iso2c", "iso3c", "iso3n", "un", "country.name")
  31 + "iso2c", "iso3c", "iso3n", "un", "wb", "country.name")
32 32 if (!origin %in% origin_codes){stop("Origin code not supported")}
33 33 if (!destination %in% destination_codes){stop("Destination code not supported")}
34 34 # Prepare output vector
3  R/countrycode_data.R
... ... @@ -1,6 +1,6 @@
1 1 #' Country code translation data frame
2 2 #'
3   -#' A data frame with 265 observations on the following 11 variables.
  3 +#' A data frame with 262 observations on the following 14 variables.
4 4 #' Used internally by the \code{countrycode()} function.
5 5 #'
6 6 #' \itemize{
@@ -15,6 +15,7 @@
15 15 #' \item iso2n: ISO-2 numeric
16 16 #' \item iso3n: ISO-3 numeric
17 17 #' \item un: United Nations numerical code
  18 +#' \item wb: World Bank (very similar but not identical to iso3c)
18 19 #' \item regex: Regular expression used to convert long names to code
19 20 #' \item region: Regions as defined in the World Bank Development Indicators
20 21 #' \item continent: Continent as defined in the World Bank Development Indicators
BIN  data/countrycode_data.rda
Binary file not shown

0 comments on commit d62b04d

Please sign in to comment.
Something went wrong with that request. Please try again.