Skip to content

Conversation

michaelquinn32
Copy link
Contributor

This PR standardizes calls to rlang in the package. It

  • removes the need to use lazyeval
  • fixes uses of rlang that weren't complete

The most notable change is that verify now works within other functions. This lets users wrap it in their own helper, (for example) setting the default error or success function.

This supports proper quoting and extraction of expressions.
verify() now works within other functions.
Add a test for verify within another function and fix error messages.
@tonyfischetti
Copy link
Owner

Thank you very much for this :)

@tonyfischetti tonyfischetti merged commit 54c477b into tonyfischetti:master May 16, 2018
@tonyfischetti
Copy link
Owner

The tests are now not passing on my machine. For example...

test-assertions.R:755: failure: all assertions work with .data pronoun without chains
`assert(test.df, within_bounds(-Inf, 2), .data$y, error_fun = just.show.error)` did not throw an error.

Do you know why this is?

@michaelquinn32
Copy link
Contributor Author

Sorry about that. It looks like dplyr/rlang won't error if it doesn't find a column when using the masking pronoun from that test. It just returns what it can.

test_fun <- function(...) {
   columns <- rlang::quos(...)
   dplyr::select(iris, !!!columns)
}

test_fun(.data$not_here)
# data frame with 0 columns and 150 rows

I can fix this. There needs to be a check that subframe has columns. I'll send it soon.

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.

2 participants