bike_tripmat: Extract station-to-station trip matrix or data.frame from...

Description Usage Arguments Value Note

Description

Extract station-to-station trip matrix or data.frame from SQLite3 database

Usage

1
2
3
bike_tripmat(bikedb, city, start_date, end_date, start_time, end_time, weekday,
  member, birth_year, gender, standardise = FALSE, long = FALSE,
  quiet = FALSE)

Arguments

bikedb

A string containing the path to the SQLite3 database. If no directory specified, it is presumed to be in tempdir().

city

City for which tripmat is to be aggregated

start_date

If given (as year, month, day) , extract only those records from and including this date

end_date

If given (as year, month, day), extract only those records to and including this date

start_time

If given, extract only those records starting from and including this time of each day

end_time

If given, extract only those records ending at and including this time of each day

weekday

If given, extract only those records including the nominated weekdays. This can be a vector of numeric, starting with Sunday=1, or unambiguous characters, so "sa" and "tu" for Saturday and Tuesday.

member

If given, extract only trips by registered members (member=1 or TRUE) or not (member=0 or FASE).

birth_year

If given, extract only records for trips by registered using giving birth_years within stated values (either single value or continuous range).

gender

If given, extract only records for trips by registered using giving the specified genders (f/m/. or 2/1/0).

standardise

If TRUE, numbers of trips are standardised to the operating durations of each stations, so trip numbers are increased for stations that have only operated a short time, and vice versa.

long

If FALSE, a square tripmat of (num-stations, num_stations) is returns; if TRUE, a long-format matrix of (stn-from, stn-to, ntrips) is returned.

quiet

If FALSE, progress is displayed on screen

Value

If long=FALSE, a square matrix of numbers of trips between each station, otherwise a long-form data.frame with three columns of of (start_station, end_station, num_trips)

Note

The city parameter should be given for databases containing data from multiple cities, otherwise most of the resultant trip matrix is likely to be empty. Both dates and times may be given either in numeric or character format, with arbitrary (or no) delimiters between fields. Single numeric times are interpreted as hours, with 24 interpreted as day's end at 23:59:59.


mpadge/sqlite3-test documentation built on May 23, 2019, 6:24 a.m.