Can be used in dplyr-syntax to remember values and objects for later use. Objects are (temporarily) stored in the certetoolbox
package environment.
remember(.data, ...)
recall(x = NULL, delete = TRUE)
value(s) to be remembered
value to be recalled
a logical to indicate whether the delete value after recalling
values can be saved with remember()
and recalled (and deleted) with recall()
.
library(dplyr, warn.conflicts = FALSE)
x <- mtcars %>% remember(nrow(.))
recall()
#> [1] 32
recall() # value removed
#> NULL
x <- mtcars %>% remember(n = nrow(.))
recall(n)
#> [1] 32
recall(n) # value removed
#> NULL
if (FALSE) { # \dontrun{
tbl %>%
filter(...) %>%
remember(rows = nrow(.)) %>%
group_by(...) %>%
summarise(...) %>%
plot2(title = "Test",
subtitle = paste("n =", recall(rows)))
} # }