Learn R Programming

cycleRtools (version 1.0.0)

elevation_correct: Generate reliable elevation data.

Description

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.

See Also

download_elev_data.

Examples

Run this code
data(cycling_data)
cycling_data$elevation.m <- elevation_correct(cycling_data, "GBR")

Run the code above in your browser using DataLab