clean_country_iso: Cleans the dataset's country names and adds iso.

View source: R/cleaning_standardizing_preprocessing_functions.R

clean_country_isoR Documentation

Cleans the dataset's country names and adds iso.

Description

Cleans the dataset actors' countries using exact matches based on the package's country dictionary and adds corresponding iso information to the dataset. For more information on clean_enc, see the vignette.

Usage

clean_country_iso(dataset, country.dict, iso = 3, clean_enc = T)

Arguments

dataset

Dataset to clean the country names for

country.dict

Country dictionary to clean the dataset against

iso

Input either 2 or 3 to select for 2 or 3 letter ISO code. Defaults to ISO3

clean_enc

Is the data read in with the correct encoding? If unknown, set as FALSE. Defaults to TRUE

Details

The clean_enc argument is used for users to denote whether the data is read in with the correct encoding. Use clean_enc = T if users are sure of the encoding that the data is in and is sure data is read in with the right encoding and clean_enc = F if users are unsure of data's encoding or if unsure if data is read in with the correct encoding.

If clean_enc = F, then the function will check the encoding of the country column in the user's dataset and tries to fix it if the data was read in with the wrong encoding (with rvest::repair_encoding()).

Value

The original dataset with the country names cleaned


datadrivenenvirolab/ClimActor documentation built on April 23, 2024, 7:40 a.m.