Learn R Programming

inegiR (version 3.0.0)

inegi_route: Returns the route between two points in Mexico

Description

Uses SAKBE API to return a route between two destiny id's considering the given parameters.

Usage

inegi_route(from, to, token, pref, vehicle, calc_cost = FALSE,
  rawJSON = FALSE)

Arguments

from

Destiny id from where the route begins

to

Destiny id of end of route

token

Sakbe API token supplied by INEGI

pref

Preference for road: 1 = with tolls (cuota), 2 = without tolls (libre), 2 = suggested route

vehicle

Vehicle choice: 0 = motorcycle, 1 = auto, 2 = two axis bus, 3 = three axis bus, 4 = four axis bus, 5 = two axis truck, 6 = three axis truck, 7 = four axis truck, 8 = five axis truck, 9 = six axis truck, 10 = seven axis truck, 11 = eight axis truck, 12 = nine axis truck.

calc_cost

if TRUE will use the price of gasoline to calculate total cost of trip. Very experimental, defaults to FALSE.

rawJSON

if TRUE returns only the JSON data, not parsed

Value

list

References

See the official API here: http://www.inegi.org.mx/desarrolladores/sakbe/apisakbe.aspx

Examples

Run this code
# NOT RUN {
# Macroplaza in Monterrey to Mexico City airport.
# }
# NOT RUN {
token <- "webservice_token"
route <- inegi_route(from = 6940, to = 57, token, pref = 2, vehicle = 1)
# }

Run the code above in your browser using DataLab