elevation_correct {cycleRtools}R Documentation

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 working directory, files are first downloaded. Note that NAs in the data will return corresponding NAs in the corrected elevation.

Usage

elevation_correct(data, country)

Arguments

data

a dataset with longitude ("lng") and lattitude ("lon") columns.

country

character string; the country to which the data pertain, given as an ISO3 code (see raster::getData("ISO3"))

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

## Not run: 
data(ridedata)

## When run the first time, geographical data will need to be downloaded.
ridedata$elevation.corrected <- elevation_correct(ridedata, "GBR")

## A Bland-Altman-type plot.
difference <- ridedata$elevation.m - ridedata$elevation.corrected
plot(difference ~ ridedata$timer.min, cex = 0.2, ylab = "raw minus corrected")
m <- mean(difference, na.rm = TRUE); stdev <- sd(difference, na.rm = TRUE)
abline(h = c(m + c(-stdev, 0, stdev)), lty = c(1, 2, 1), col = "red")

## End(Not run)


[Package cycleRtools version 1.1.1 Index]