Learn R Programming

stplanr (version 0.4.0)

table2matrix: Return Matrix containing travel times between origins and destinations

Description

Return Matrix containing travel times between origins and destinations

Usage

table2matrix(lat, lng, destlat = NA, destlng = NA, api = 5,
  profile = "driving", protocol = "v1",
  osrmurl = "http://router.project-osrm.org")

Arguments

lat

Numeric vector containing latitude coordinate for each coordinate to calculate travel times. Also accepts dataframe with latitude in the first column and longitude in the second column.

lng

Numeric vector containing longitude coordinate for each coordinate to calculate travel times.

destlat

Numeric vector containing destination latitude coordinate for each coordinate to calculate travel times. Also accepts dataframe with latitude in the first column and longitude in the second column. Default is value of lat.

destlng

Numeric vector containing longitude coordinate for each destination coordinate to calculate travel times. Default is value of lng.

api

An integer value containing the OSRM API version (either 4 or 5). Default is 5.

profile

OSRM profile to use (for API v5), defaults to "driving".

protocol

The protocol to use for the API (for v5), defaults to "v1".

osrmurl

Base URL of the OSRM service

Details

Return a matrix containing travel times between origins and destinations

Examples

Run this code
# NOT RUN {
table2matrix(seq(from = 50, to = 52, by = 0.1), seq(from = 12, to = 14, by = 0.1))
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab