Convenience wrapper that appends a region column (and optionally a
subregion) to a data frame by looking up an existing country column with
recode_region().
Arguments
- data
A data frame.
- country
The country column (unquoted).
- region_to
Name of the region column to add. Defaults to
"region".- subregion
If
TRUE, also add asubregioncolumn. Defaults toFALSE.- quiet
Passed to
recode_region().
Details
This is the data-frame-friendly form of recode_region(): point it at an
existing country column and it appends a region column (named via
region_to) and, optionally, a subregion. Handy right after read_folder()
to enrich raw exports before grouping by region. The lookup, matching and
unmatched-country warning behave exactly as in recode_region().
