-
Notifications
You must be signed in to change notification settings - Fork 14
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
Error when used with memoise
#45
Comments
I also faced a similar issue, when I had to resolve a conflict related to Furthermore, this issue seems to be related: #44 |
You are using It might be a We can fix this specific case by substituting library(conflicted)
library(tidyverse)
library(lubridate)
library(memoise)
tib <- tibble(x = 1:2, y = 3:4)
f <- function(tib) {
mutate(tib, z = if_else(x == 1, y, x))
}
mf <- memoise(f)
body(mf) <- do.call(substitute, list(body(mf), list(setdiff = quote(base::setdiff))))
class(mf) <- c("memoised", "function") # seems that `body<-` strips off the class :(
f(tib)
#> # A tibble: 2 x 3
#> x y z
#> <int> <int> <int>
#> 1 1 3 3
#> 2 2 4 2
mf(tib)
#> # A tibble: 2 x 3
#> x y z
#> <int> <int> <int>
#> 1 1 3 3
#> 2 2 4 2 Created on 2019-11-21 by the reprex package (v0.3.0) |
This is now resolved because lubridate and dplyr use the same definition of |
I can't really tell what's going on here, but I'm getting an error about
setdiff()
when I haven't used it at all.Created on 2019-07-23 by the reprex package (v0.3.0)
The text was updated successfully, but these errors were encountered: