Extract summary statistics of database
bike_summary_stats(bikedb)
| bikedb | A string containing the path to the SQLite3 database.
If no directory specified, it is presumed to be in |
|---|
A data.frame containing numbers of trips and stations along
with times and dates of first and last trips for each city in database and a
final column indicating whether the files match the latest published
versions.
data_dir <- tempdir () bike_write_test_data (data_dir = data_dir) # dl_bikedata (city = 'la', data_dir = '.') # or download some real data! bikedb <- file.path (data_dir, 'testdb') store_bikedata (data_dir = data_dir, bikedb = bikedb)#>#>#>#> reading file 1/1: /tmp/Rtmp0qGggG/201612-citibike-tripdata.csv#>#>#>#> reading file 1/1: /tmp/Rtmp0qGggG/201604-hubway-tripdata.csv#>#>#>#> reading file 1/1: /tmp/Rtmp0qGggG/Divvy_Trips_sample.csv#>#>#>#> reading file 1/1: /tmp/Rtmp0qGggG/2017-Q1-Trips-History-Data.csv#>#>#>#> reading file 1/1: /tmp/Rtmp0qGggG/la_metro_gbfs_trips_Q1_2017.csv#>#>#> reading file 1/1: /tmp/Rtmp0qGggG/01aJourneyDataExtract10Jan16-23Jan16.csv#>#>#>#> [1] 1198bike_summary_stats ('testdb')#> # A tibble: 7 x 5 #> num_trips num_stations first_trip last_trip latest_files #> * <dbl> <dbl> <fctr> <fctr> <lgl> #> 1 1198 2187 2016-01-10 00:00:00 2017-03-31 23:59:00 NA #> 2 200 93 2016-04-01 00:01:19 2016-04-01 07:49:26 FALSE #> 3 200 581 2016-12-31 19:04:56 2016-12-31 23:57:52 FALSE #> 4 200 456 2017-03-31 22:09:00 2017-03-31 23:59:00 FALSE #> 5 198 50 2017-01-01 00:15:00 2017-01-01 16:55:00 FALSE #> 6 200 774 2016-01-10 00:00:00 2016-01-10 01:08:00 FALSE #> 7 200 233 2016-12-01 00:00:04 2016-12-01 01:33:37 FALSE#> [1] 6bike_rm_db (bikedb)#> [1] TRUE# don't forget to remove real data! # file.remove (list.files ('.', pattern = '.zip'))