memoise icon indicating copy to clipboard operation
memoise copied to clipboard

Memoised pipe?

Open StaffanBetner opened this issue 2 years ago • 0 comments

Is it possible to memoise the magrittr pipe %>%?

Just as-is it doesn't seem to work, see reprex:

library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
library(magrittr)
library(memoise)

`%>%` <- memoise(`%>%`)
mtcars %>% mutate(x = mpg)
#> Error in mutate(x = mpg): object 'mpg' not found

Created on 2022-06-17 by the reprex package (v2.0.1)

StaffanBetner avatar Jun 17 '22 08:06 StaffanBetner