memoise
memoise copied to clipboard
Memoised pipe?
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)