Skip to content
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

Override View() to support memoised functions #140

Open
wurli opened this issue Aug 17, 2022 · 1 comment
Open

Override View() to support memoised functions #140

wurli opened this issue Aug 17, 2022 · 1 comment

Comments

@wurli
Copy link

wurli commented Aug 17, 2022

In RStudio, calling View() on a memoised function does not take you to the original function's source. On the one hand this makes it very clear to the user that their function is doing special stuff; on the other it can be a pain during development. This behaviour could be changed, e.g. as follows:

View <- function(x, title) {
  if (memoise::is.memoised(x)) {
    x <- environment(x)[["_f"]]
  }
  eval(substitute(
    get("View", envir = as.environment("package:utils"))(x, title)
  ))
}
@wurli
Copy link
Author

wurli commented Aug 23, 2023

NB, tibble::view() is an enhanced version of View() for dataframes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant