test curley braces
Tries to close #216
But this is not really working yet... Just different attempts to solve that issue.
Codecov Report
Merging #217 (fc86356) into main (224448c) will increase coverage by
0.03%. The diff coverage is100.00%.
@@ Coverage Diff @@
## main #217 +/- ##
==========================================
+ Coverage 84.64% 84.68% +0.03%
==========================================
Files 54 54
Lines 3530 3539 +9
==========================================
+ Hits 2988 2997 +9
Misses 542 542
| Impacted Files | Coverage Δ | |
|---|---|---|
| R/data_match.R | 97.46% <100.00%> (+0.32%) |
:arrow_up: |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
seems like data_wizard(mtcars, filter = {var} != 0) evaluates the filter argument immediately after function call and sets it to TRUE, so my whole approach here doesn't seem to work.
Can we somehow convert this into a draft, so it won't be merged accidentally?
Done!
gluestick might be useful here (but I couldn't make it work so far)
Much easier to implement thanks to the previous commits this week. All tests pass locally, and here are some examples. Is this what you had in mind?
When vars are in global environment:
library(datawizard)
var = "mpg"
var2 = "hp"
data_filter(mtcars, "{var} > 30 & {var2} <= 66")
#> mpg cyl disp hp drat wt qsec vs am gear carb
#> Fiat 128 32.4 4 78.7 66 4.08 2.200 19.47 1 1 4 1
#> Honda Civic 30.4 4 75.7 52 4.93 1.615 18.52 1 1 4 2
#> Toyota Corolla 33.9 4 71.1 65 4.22 1.835 19.90 1 1 4 1
data_filter(mtcars, {var} > 30 & {var2} <= 66)
#> mpg cyl disp hp drat wt qsec vs am gear carb
#> Fiat 128 32.4 4 78.7 66 4.08 2.200 19.47 1 1 4 1
#> Honda Civic 30.4 4 75.7 52 4.93 1.615 18.52 1 1 4 2
#> Toyota Corolla 33.9 4 71.1 65 4.22 1.835 19.90 1 1 4 1
When vars are passed in a function:
library(datawizard)
foo <- function(var, var2) {
data_filter(mtcars, filter = {var} > 30 & {var2} <= 66)
}
foo("mpg", "hp")
#> mpg cyl disp hp drat wt qsec vs am gear carb
#> Fiat 128 32.4 4 78.7 66 4.08 2.200 19.47 1 1 4 1
#> Honda Civic 30.4 4 75.7 52 4.93 1.615 18.52 1 1 4 2
#> Toyota Corolla 33.9 4 71.1 65 4.22 1.835 19.90 1 1 4 1
foo <- function(var, var2) {
data_filter(mtcars, filter = "{var} > 30 & {var2} <= 66")
}
foo("mpg", "hp")
#> mpg cyl disp hp drat wt qsec vs am gear carb
#> Fiat 128 32.4 4 78.7 66 4.08 2.200 19.47 1 1 4 1
#> Honda Civic 30.4 4 75.7 52 4.93 1.615 18.52 1 1 4 2
#> Toyota Corolla 33.9 4 71.1 65 4.22 1.835 19.90 1 1 4 1
@rempsyc since you opened #216, do you want to check if this PR solves your use cases?
Wooah, that's amazing! Commit 2c58497 solved my specific use case for check_outliers by allowing complete character string usage, and this one solves my general use case as described in the PR. It will be way easier to program internally with it. This can close #216 on merge now. Thanks!
@strengejacke Are you ok with the examples above? Or do you have other use cases to test?
@strengejacke Are you ok with the examples above? Or do you have other use cases to test?
I had not many particular use cases in mind, your examples look great and are already an improvement to what we currently have. We should probably - if there's such a case - describe what works and what known issue are (i.e. what should users expect no being working at the moment).