I often use View() in RStudio to navigate to a function's source code, but this doesn't produce anything helpful if the function in question is memoised. As a result I tend to overload View() like so:
View <- function(x, title) {
if (memoise::is.memoised(x)) {
x <- environment(x)[["_f"]]
}
eval(substitute(
get("View", envir = as.environment("package:utils"))(x, title)
))
}
I'd suggest including something like this in {memoise}, or perhaps mentioning the workaround in the documentation, as this can be an annoying inconvenience that I doubt many users will find a workaround for.
NB, tibble::view() is an enhanced version of View() for dataframes.
I often use
View()
in RStudio to navigate to a function's source code, but this doesn't produce anything helpful if the function in question is memoised. As a result I tend to overloadView()
like so:I'd suggest including something like this in {memoise}, or perhaps mentioning the workaround in the documentation, as this can be an annoying inconvenience that I doubt many users will find a workaround for.
NB,
tibble::view()
is an enhanced version ofView()
for dataframes.