Learn R Programming

SeaVal (version 1.1.1)

add_country_names: Add country names to a data table with lon/lat coordinates

Description

Takes a data table with lon/lat coordinates and adds a column 'country' to it, containing the name of the country, the coordinate belongs to.

Usage

add_country_names(dt, regions = EA_country_names())

Value

The provided data table with an extra column with country names

Arguments

dt

the data table.

regions

Character vector of country names for which shapefiles are loaded. By default, countries in East Africa are loaded, see EA_country_names. If you set regions = '.', the entire world is loaded, but this makes the function slower.

Examples

Run this code
dt = add_country_names(chirps_monthly)

Run the code above in your browser using DataLab