Using the latitude and longitude columns of the supplied formatted
data, a vector of elevation values is returned of the same length. If no
elevation data files exist within the specified directory, files are first
downloaded. Note that NAs in the data will return corresponding NAs in the
corrected elevation.
Usage
elevation_correct(data, country, dir = "default")
Arguments
data
a dataset with longitude ("lng") and lattitude ("lat") columns.
country
character string; the country to which the data pertain, given
as an ISO3 code (see raster::getData("ISO3"))
dir
the directory in which the necessary elevation data is contained
or should be downloaded. "default" creates a hidden directory
(.elevation_data) in the home directory.
Value
a vector of elevation values. If there is an error at any stage, a
vector of NAs is returned.