Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to tripmat and associated functions #7

Merged
merged 2 commits into from
Mar 20, 2017

Conversation

richardellison
Copy link
Contributor

I have updated the tripmat() function (as well as associated functions) to use RSQLite with dbBind instead of dplyr to use COUNT(*) and GROUP_BY(). I have a made a few key changes to the behaviour of tripmat:

  1. When trips are filtered by a particular date or time (or both), any trips that have at least a portion fall within the specified dates/times are counted. This is a change from the previous behaviour that required the full trip to be within the specified date ranges.
  2. A time of 23 is now interpreted as 23:00:00 to be consistent with earlier times. 24 is interpreted as 23:59:59.
  3. tripmat always returns a full matrix, that contains all stations regardless of if trips are used. This compares to how a square matrix was returned but only for stations where at least one trip starts or ends.

Merge remote-tracking branch 'upstream/master'

# Conflicts:
#	NAMESPACE
#	R/tripmat.R
@richardellison
Copy link
Contributor Author

I should add that because of these changes I have updated the tests to ensure they are correct.

@codecov-io
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (master@e96aaf9). Click here to learn what that means.
The diff coverage is 91.07%.

@@            Coverage Diff            @@
##             master       #7   +/-   ##
=========================================
  Coverage          ?   83.95%           
=========================================
  Files             ?        4           
  Lines             ?      405           
  Branches          ?        0           
=========================================
  Hits              ?      340           
  Misses            ?       65           
  Partials          ?        0
Impacted Files Coverage Δ
R/dl_bikedata.R 93.1% <100%> (ø)
src/spatialitedb.cpp 77.5% <100%> (ø)
R/tripmat.R 87.93% <90.38%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e96aaf9...aeb3f5e. Read the comment docs.

@mpadge
Copy link
Member

mpadge commented Mar 20, 2017

That's great Richard - and you even went beyond the call and modified the tests accordingly! Thanks for the 24->23:59:59 - that had occurred to me too, but only after I'd already committed 23. But mostly, thanks for the excellent index creation function with full >=3.9.0 check - it took me a little while to get my head around what you were doing in create_db_indexes, but it seems like a grand and elegant solution. The filter_datetime with RSQLite is also a great improvement on the previous version.

Now i've gotta get cracking on getting the rest of the data in to the db ...

@mpadge mpadge merged commit 213b00b into ropensci:master Mar 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants