Description Usage Arguments Value Examples
get_api_data
gets real-time data on bike availability, stations, and
system from the API for
Please read the API documentation for each City Bike API before using this function.
The real-time data is provided in the GBFS (General Bikeshare Feed Specification) format, which you can read more about on here.
The data is provided according to the Norwegian License for Open Government Data 2.0 NLOD 2.0.
1 | get_api_data(client_id, data, city, return_df = FALSE)
|
client_id |
A string. The string should represent a client identifier to access the
API. The client identifier must be of the form |
data |
A string. The data that you want to get from the API. The options are "availability", "stations", and "system". |
city |
A string. The city, or city bike service API, that you want to get data from. The options are "Oslo", "Bergen", or "Trondheim". |
return_df |
Either |
If return_df = FALSE
, then the function returns a list
that
contains two elements: a data frame with the
"main" data, and the datetime (POSIX) for the API request. If
return_df = TRUE
, then the function returns only a tibble.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## Not run:
# Get data on bike "availability"
oslo_api_data <- get_api_data(client_id = "mycompany-myservice",
data = "availability",
city = "Oslo")
# Get data on bike "availability", but return a tibble
oslo_winter_bike <- get_api_data(client_id = "myname-myapp",
data = "availability",
city = "Oslo",
return_df = TRUE)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.