# Built-in reponse example
library(xml2)
doc = as_xml_document(response_matrix)
if (FALSE) {
# Text file with API key
key = readLines("~/key")
# Using 'data.frame' input
doc = mp_matrix(
origins = rbind(c(34.811, 31.892), c(35.212, 31.769)),
destinations = c(34.781, 32.085),
key = key
)
# Using 'character' input
locations = c("Tel-Aviv", "Jerusalem", "Beer-Sheva", "Eilat")
doc = mp_matrix(
origins = locations,
destinations = locations,
key = key
)
# Setting transit modes
locations = c("Tel-Aviv", "Beer-Sheva", "Eilat")
doc = mp_matrix(
origins = locations,
destinations = locations,
key = key,
mode = "transit",
transit_mode = "train"
)
}
Run the code above in your browser using DataLab