{"id":13398218,"url":"https://github.com/ropensci/bikedata","last_synced_at":"2025-12-27T10:54:57.973Z","repository":{"id":77960053,"uuid":"76273350","full_name":"ropensci/bikedata","owner":"ropensci","description":":bike: Extract data from public hire bicycle systems","archived":false,"fork":false,"pushed_at":"2024-02-06T11:25:59.000Z","size":5622,"stargazers_count":81,"open_issues_count":19,"forks_count":16,"subscribers_count":9,"default_branch":"main","last_synced_at":"2024-09-07T18:39:44.513Z","etag":null,"topics":["bicycle-hire","bicycle-hire-systems","bike-data","bike-hire","database","peer-reviewed","r","r-package","rstats"],"latest_commit_sha":null,"homepage":"https://docs.ropensci.org/bikedata","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ropensci.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":"codemeta.json"}},"created_at":"2016-12-12T16:14:07.000Z","updated_at":"2024-04-29T14:29:24.000Z","dependencies_parsed_at":"2024-10-25T17:02:31.793Z","dependency_job_id":"bad959e4-9346-4ddb-a648-5ff5aa3b99d5","html_url":"https://github.com/ropensci/bikedata","commit_stats":{"total_commits":649,"total_committers":10,"mean_commits":64.9,"dds":0.04314329738058553,"last_synced_commit":"54eeed586fda8692584726653cb06521cacfc5c8"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2Fbikedata","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2Fbikedata/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2Fbikedata/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2Fbikedata/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ropensci","download_url":"https://codeload.github.com/ropensci/bikedata/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243511591,"owners_count":20302577,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bicycle-hire","bicycle-hire-systems","bike-data","bike-hire","database","peer-reviewed","r","r-package","rstats"],"created_at":"2024-07-30T19:00:20.454Z","updated_at":"2025-12-27T10:54:57.926Z","avatar_url":"https://github.com/ropensci.png","language":"R","funding_links":[],"categories":["Uncategorized","Projects","Energy Consumption"],"sub_categories":["Uncategorized","Mobility and Transportation"],"readme":"---\ntitle: \"bikedata\"\nkeywords: \"bicycle hire systems, bike hire systems, bike hire, bicycle hire, database, bike data\"\noutput:\n  rmarkdown::html_vignette:\n    self_contained: no\n\n  md_document:\n    variant: markdown_github\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, echo = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"README-\"\n)\n```\n\n[![R build status](https://github.com/ropensci/bikedata/workflows/R-CMD-check/badge.svg)](https://github.com/ropensci/bikedata/actions?query=workflow%3AR-CMD-check)\n[![codecov](https://codecov.io/gh/ropensci/bikedata/branch/master/graph/badge.svg)](https://codecov.io/gh/ropensci/bikedata)\n[![Project Status: Active](http://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/)\n[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/bikedata)](https://cran.r-project.org/package=bikedata) \n[![CRAN Downloads](https://cranlogs.r-pkg.org/badges/grand-total/bikedata?color=orange)](https://cran.r-project.org/package=bikedata)\n[![](http://badges.ropensci.org/116_status.svg)](https://github.com/ropensci/software-review/issues/116)\n[![status](https://joss.theoj.org/papers/10.21105/joss.00471/status.svg)](https://joss.theoj.org/papers/10.21105/joss.00471)\n\n\nThe `bikedata` package aims to enable ready importing of historical trip data\nfrom all public bicycle hire systems which provide data, and will be expanded on\nan ongoing basis as more systems publish open data. Cities and names of\nassociated public bicycle systems currently included, along with numbers of\nbikes and of docking stations (from \n[wikipedia](https://en.wikipedia.org/wiki/List_of_bicycle-sharing_systems#Cities)),\nare\n\nCity | Hire Bicycle System | Number of Bicycles | Number of Docking Stations\n--- | --- | --- | ---\nLondon, U.K. | [Santander Cycles](https://tfl.gov.uk/modes/cycling/santander-cycles) | 13,600 | 839\nSan Francisco Bay Area, U.S.A. | [Ford GoBike](https://www.fordgobike.com/)  | 7,000 | 540 \nNew York City NY, U.S.A. | [citibike](https://www.citibikenyc.com/) | 7,000 | 458\nChicago IL, U.S.A. | [Divvy](https://www.divvybikes.com/) | 5,837 | 576\nMontreal, Canada | [Bixi](https://bixi.com/) | 5,220 | 452\nWashingon DC, U.S.A. | [Capital BikeShare](https://www.capitalbikeshare.com/) | 4,457 | 406\nGuadalajara, Mexico | [mibici](https://www.mibici.net/) | 2,116 | 242\nMinneapolis/St Paul MN, U.S.A. | [Nice Ride](https://www.niceridemn.com/) | 1,833 | 171\nBoston MA, U.S.A. | [Hubway](https://www.bluebikes.com/) | 1,461 | 158\nPhiladelphia PA, U.S.A. | [Indego](https://www.rideindego.com) | 1,000 | 105\nLos Angeles CA, U.S.A. | [Metro](https://bikeshare.metro.net/) | 1,000 | 65\n\nThese data include the places and times at which all trips start and end. Some\nsystems provide additional demographic data including years of birth and genders\nof cyclists. The list of cities may be obtained with the `bike_cities()`\nfunctions, and details of which include demographic data with\n`bike_demographic_data()`.\n\nThe following provides a brief overview of package functionality. For more\ndetail, see the\n[vignette](https://docs.ropensci.org/bikedata/articles/bikedata.html).\n\n------\n\n\n## 1 Installation\n\nCurrently a development version only which can be installed with the following\ncommand,\n```{r, eval=FALSE}\ndevtools::install_github(\"ropensci/bikedata\")\n```\n```{r usage2, echo=FALSE, message=FALSE}\ndevtools::load_all (\".\")\n#devtools::load_all (\".\", recompile=TRUE)\n#devtools::document (\".\")\n#goodpractice::gp (\"bikedata\")\n#devtools::check (\".\")\n#testthat::test_dir (\"./tests/\")\n#Rcpp::compileAttributes()\n```\nand then loaded the usual way\n```{r, eval = FALSE}\nlibrary (bikedata)\n```\n\n\n```{r echo=FALSE, message=FALSE, warning=FALSE, error=FALSE}\noptions(width = 120)\n```\n\n\n## 2 Usage\n\nData may downloaded for a particular city and stored in an `SQLite3` database\nwith the simple command,\n```{r, echo = FALSE, eval = FALSE}\ndl_bikedata (city = 'ny', data_dir = '/data/data/bikes/nyc-temp/',\n             dates = 201601:201603)\nstore_bikedata (bikedb = 'bikedb', data_dir = '/data/data/bikes/nyc-temp/')\n```\n```{r, eval = FALSE}\nstore_bikedata (city = 'nyc', bikedb = 'bikedb', dates = 201601:201603)\n# [1] 2019513\n```\nwhere the `bikedb` parameter provides the name for the database, and the\noptional argument `dates` can be used to specify a particular range of dates\n(Jan-March 2016 in this example).  The `store_bikedata` function returns the\ntotal number of trips added to the specified database. The primary objects\nreturned by the `bikedata` packages are 'trip matrices' which contain aggregate\nnumbers of trips between each pair of stations. These are extracted from the\ndatabase with:\n```{r, eval = FALSE}\ntm \u003c- bike_tripmat (bikedb = 'bikedb')\ndim (tm); format (sum (tm), big.mark = ',')\n```\n```{r, echo = FALSE}\nc (518, 518)\n\"2,019,513\"\n```\nDuring the specified time period there were just over 2 million trips between\n518 bicycle docking stations.  Note that the associated databases can be very\nlarge, particularly in the absence of `dates` restrictions, and extracting these\ndata can take quite some time.\n\nData can also be aggregated as daily time series with\n```{r, eval = FALSE}\nbike_daily_trips (bikedb = 'bikedb')\n```\n```{r, echo = FALSE}\nn \u003c- 87\ndates \u003c- c ('2016-01-01', '2016-01-02', '2016-01-03', '2016-01-04',\n            '2016-01-05', '2016-01-06', '2016-01-07', '2016-01-08',\n            '2016-01-08', '2016-01-10', rep (NA, n - 10))\nnt \u003c- c (11172, 14794, 15775, 19879, 18326, 24922, 28215, 29131, 21140, 14481,\n         rep (NA, n - 10))\ntibble::tibble (date = dates, numtrips = nt)\n```\n\nA summary of all data contained in a given database can be produced as\n```{r, eval = FALSE}\nbike_summary_stats (bikedb = 'bikedb')\n#\u003e    num_trips num_stations          first_trip       last_trip latest_files\n#\u003e ny  2019513          518 2016-01-01 00:00    2016-03-31 23:59        FALSE\n```\nThe final field, `latest_files`, indicates whether the files in the database are\nup to date with the latest published files.\n\n### 2.1 Filtering trips by dates, times, and weekdays\n\nTrip matrices can be constructed for trips filtered by dates, days of the week,\ntimes of day, or any combination of these.  The temporal extent of a `bikedata`\ndatabase is given in the above `bike_summary_stats()` function, or can be\ndirectly viewed with\n```{r, eval = FALSE}\nbike_datelimits (bikedb = 'bikedb')\n```\n```{r, echo = FALSE}\nres \u003c- c (\"2016-01-01 00:00\", \"2016-03-31 23:59\")\nnames (res) \u003c- c (\"first\", \"last\")\nres\n```\nAdditional temporal arguments which may be passed to the `bike_tripmat`\nfunction include `start_date`, `end_date`, `start_time`, `end_time`, and\n`weekday`. Dates and times may be specified in almost any format, but larger\nunits must always precede smaller units (so years before months before days;\nhours before minutes before seconds). The following examples illustrate the\nvariety of acceptable formats for these arguments.\n```{r, eval = FALSE}\ntm \u003c- bike_tripmat ('bikedb', start_date = \"20160102\")\ntm \u003c- bike_tripmat ('bikedb', start_date = 20160102, end_date = \"16/02/28\")\ntm \u003c- bike_tripmat ('bikedb', start_time = 0, end_time = 1) # 00:00 - 01:00\ntm \u003c- bike_tripmat ('bikedb', start_date = 20160101, end_date = \"16,02,28\",\n                 start_time = 6, end_time = 24) # 06:00 - 23:59\ntm \u003c- bike_tripmat ('bikedb', weekday = 1) # 1 = Sunday\ntm \u003c- bike_tripmat ('bikedb', weekday = c('m', 'Th'))\ntm \u003c- bike_tripmat ('bikedb', weekday = 2:6,\n                    start_time = \"6:30\", end_time = \"10:15:25\")\n```\n\n### 2.2 Filtering trips by demographic characteristics\n\nTrip matrices can also be filtered by demographic characteristics through\nspecifying the three additional arguments of `member`, `gender`, and\n`birth_year`. `member = 0` is equivalent to `member = FALSE`, and `1` equivalent\nto `TRUE`. `gender` is specified numerically such that values of `2`, `1`, and\n`0` respectively translate to female, male, and unspecified. The following lines\ndemonstrate this functionality\n```{r, eval = FALSE}\nsum (bike_tripmat ('bikedb', member = 0))\nsum (bike_tripmat ('bikedb', gender = 'female'))\nsum (bike_tripmat ('bikedb', weekday = 'sat', birth_year = 1980:1990,\n                   gender = 'unspecified'))\n```\n\n### 3. Citation\n\n```{r}\ncitation (\"bikedata\")\n```\n\n### 4. Code of Conduct\n\nPlease note that this project is released with a [Contributor Code of\nConduct](https://ropensci.org/code-of-conduct/). By contributing to this\nproject you agree to abide by its terms.\n\n[![ropensci\\_footer](https://ropensci.org//public_images/github_footer.png)](https://ropensci.org/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fropensci%2Fbikedata","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fropensci%2Fbikedata","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fropensci%2Fbikedata/lists"}