View source: R/add_countrycode.R
add_countrycode | R Documentation |
Wrapper function for countrycode::countrycode()
enabling piped
execution.
add_countrycode(data, ..., warn = TRUE, na.rm = FALSE)
add_countrycode_(data, origin, destination, warn = TRUE, na.rm = FALSE)
data |
A data frame. |
... |
Key-value pairs for NSE of |
warn |
Prints unique elements from sourcevar for which no match was found. |
na.rm |
If |
origin |
Named scalar linking source column to source coding scheme. See
|
destination |
Named scalar linking destination column name to
destination coding scheme. See |
A data frame.
Michaja Pehl
library(dplyr)
data <- tibble(
country = c('Belgium', 'Narnia', 'Russia', 'Botswana'),
data = 1:4)
data %>% add_countrycode(country = country.name, m49.code = un)
data %>% add_countrycode_(c('country' = 'country.name'), 'iso3c',
warn = FALSE, na.rm = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.