This is equivalent to the NS reisplanner, you give in a from and to station, the timestamp, if you want the time to be your departure or arrival time, and optionally if you have a NS year card (has effect on some travels).

get_travel_advise(fromStation, toStation, dateTime = NULL,
  departure = TRUE, yearCard = FALSE, hslAllowed = FALSE,
  previousAdvises = 4, nextAdvises = 4)

Arguments

fromStation

the station to start from, for instance "Rotterdam Centraal"

toStation

the station to end, for instance "Utrecht Centraal"

dateTime

defaults to current time, but you can use a different one: f.i. 2012-02-21T15:50, You can also use the datetime() function

departure

is the datetime the start or end time? do you want to depart on that date or arrive, defaults to departure

yearCard

if you have a NS year card (jaarabonnement) some trips will be different

hslAllowed

use of the high speed train

previousAdvises

how many advices do you want before the time

nextAdvises

how many advises do you want after

Details

You can also specify how many trips before and after the chosen time you want to collect (defaults to 4, maximum is 5 before, and 5 after).

Some things to consider: station names need to be in Dutch but the NS webservice also accepts shortened versions: "Utrecht Centraal" and "ut" is apparently the same. Station names can be found with the get_stationlist() call.

Although the documentation https://www.ns.nl/en/travel-information/ns-api/documentation-travel-recommendations.html is in English, the returned values are all in Dutch. And I keep the results in Dutch.

Examples

# NOT RUN {
get_travel_advise("Amsterdam Centraal",
"Utrecht Centraal",dateTime = "2018-08-01T15:21",departure = TRUE)
# }