R/database-stats.R
bike_latest_files.RdCheck whether files in database are the latest published files
bike_latest_files(bikedb)
| bikedb | A string containing the path to the SQLite3 database.
If no directory specified, it is presumed to be in |
|---|
A named vector of binary values: TRUE is files in bikedb are
the latest versions; otherwise FALSE, in which case store_bikedata
could be run to update the database.
data_dir <- tempdir () bike_write_test_data (data_dir = data_dir) # or download some real data! # dl_bikedata (city = 'la', data_dir = data_dir) # Remove one London file that triggers an API call which may fail tests: file.remove (file.path (tempdir(), "01aJourneyDataExtract10Jan16-23Jan16.csv"))#> [1] TRUE#>#>#>#> reading file 1/3: /tmp/Rtmp88OwDl/hubway_Trips_2012.csv #> reading file 2/3: /tmp/Rtmp88OwDl/201701-hubway-tripdata.csv #> reading file 3/3: /tmp/Rtmp88OwDl/201801_hubway_tripdata.csv#>#>#>#> reading file 1/1: /tmp/Rtmp88OwDl/Divvy_Trips_sample.csv#>#>#>#> reading file 1/1: /tmp/Rtmp88OwDl/2017Q1-capitalbikeshare-tripdata-temp.csv#>#>#>#> reading file 1/1: /tmp/Rtmp88OwDl/la_metro_gbfs_trips_Q1_2017.csv#>#>#>#> reading file 1/1: /tmp/Rtmp88OwDl/Nice_Ride_trip_history_2012_season.csv#>#>#>#> reading file 1/1: /tmp/Rtmp88OwDl/201612-citibike-tripdata.csv#>#>#> [1] 1598# bike_latest_files (bikedb) # All false because test data are not current, but would pass with real data bike_rm_test_data (data_dir = data_dir)#> [1] 12bike_rm_db (bikedb)#> [1] TRUE# don't forget to remove real data! # file.remove (list.files (data_dir, pattern = '.zip'))