MilesMcBain / friendlyeval

A friendly interface to tidyeval/rlang that will excuse itself when you're done.
Other
107 stars 6 forks source link

error when using rlang 0.3.3 and dplyr 0.8.0.1 #11

Open rpodcast opened 5 years ago

rpodcast commented 5 years ago

I'm not sure which of the packages is causing the error, but here is the error I receive when running the filter_loudly example in the readme. This is running on R 3.5.2 with dplyr 0.8.0.1, rlang 0.3.3, and friendlyeval 0.1.1:

filter_loudly <- function(x, ...){
  dots <- list(...)
  ## if accepting list arguments, should check all are character
  stopifnot(purrr::every(dots, is.character))

  in_rows <- nrow(x)
  out <- filter(x, !!!treat_strings_as_exprs(dots))
  out_rows <- nrow(out)
  message("Filtered out ",in_rows-out_rows," rows.")
  return(out) 
}

data(mtcars)
filter_loudly(mtcars, 'cyl >= 6', 'am == 1')

Error:

Error: `x` must be a character vector or an R connection
Call `rlang::last_error()` to see a backtrace 

> rlang::last_error()
<error>
message: `x` must be a character vector or an R connection
class:   `rlang_error`
backtrace:
 1. global::filter_loudly(mtcars, "cyl >= 6", "am == 1")
 8. friendlyeval::treat_strings_as_exprs(dots)
 9. rlang::parse_exprs(arg)
Call `rlang::last_trace()` to see the full backtrace