-
Notifications
You must be signed in to change notification settings - Fork 991
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
Fixing bug in 'on' with complex variable names #3094
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3094 +/- ##
==========================================
+ Coverage 90.92% 90.97% +0.04%
==========================================
Files 61 61
Lines 11817 11844 +27
==========================================
+ Hits 10745 10775 +30
+ Misses 1072 1069 -3
Continue to review full report at Codecov.
|
wow, this is great example of high quality PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I would extract parse_on
into top level of R file, so the [
will gets a little smaller and more read-able. Unless you strongly agree with me, no need to proceed with this as it is minor syntactic sugar stuff.
I tend to strongly agree with you @jangorecki :). Therefore, I have factored it out in the latest commit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Just needs coverage of the two stop()s and one branch to achieve 100% diff coverage please.
… strictly internal.
Thanks @mattdowle for the review. I have adapted the tests so that all stops and branches are hit. Still, diff coverage is only 98.3 %. Looking into it suggests, that a curly bracket after an |
I filed the covr issue here : r-lib/covr#339 |
we need to replace
|
trimws is a very simple helper function... we should add it to utils |
To link it for completeness, |
Closes #3092
Closes #2931
Changes
The logic, how the 'on' string gets parsed and variable names + operators are extracted has been rewritten in order to:
colA>=1
Many thanks to @telenz for figuring out the algorithm.
Tests
I am assuming that the documented standard behaviour of 'on' is thoroughly tested already. Therefore, new tests only comprise situations with complex variable names including operators like
colA>=1
and 'on' clauses with white spaces around the operator.Performance
No significant additional overhead. Tests in
tests.Rraw
run as fast as before. The following example with a rather complex 'on' clause shows no speed impact of back-tick 'ed variable names: