get_gbfs | R Documentation |
get_gbfs
grabs bikeshare data supplied in the General Bikeshare
Feed Specification format for a given city. By default, the function returns
the results as a named list of dataframes, but to make accumulation of
datasets over time straightforward, the user can also save the results
as .Rds files that will be automatically row-binded.
Metadata for each dataset can be found at:
https://github.com/NABSA/gbfs/blob/master/gbfs.md
get_gbfs(city, feeds = "all", directory = NULL, output = NULL)
city |
A character string that can be matched to a city or a url to an
active gbfs.json feed. See |
feeds |
Optional. A character string specifying which feeds should be saved.
Options are |
directory |
Optional. Path to a folder (or folder to be created) where the feed will will be saved. |
output |
Optional. The type of output method. By default, output method
will be inferred from the |
The output of this function depends on the arguments supplied to
output
and directory
. Either a folder of .rds dataframes saved
at the given path, a returned named list of dataframes, or both.
The function will raise an error if the directory
and output
arguments seem to conflict.
# grab all of the feeds released by portland's # bikeshare program and return them as a # named list of dataframes get_gbfs(city = "biketown_pdx") # if, rather than returning the data, we wanted to save it: get_gbfs(city = "biketown_pdx", directory = tempdir()) # note that, usually, we'd supply a character string # (like "pdx", maybe,) to the directory argument # instead of `tempdir()`. # if we're having trouble specifying the correct feed, # we can also supply the actual URL to the feed get_gbfs(city = "https://gbfs.biketownpdx.com/gbfs/gbfs.json") # the examples above grab every feed that portland releases. # if, instead, we just wanted the dynamic feeds get_gbfs(city = "biketown_pdx", feeds = "dynamic")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.