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

View(memoised_function) produces unhelpful results #150

Closed
wurli opened this issue Aug 23, 2023 · 1 comment
Closed

View(memoised_function) produces unhelpful results #150

wurli opened this issue Aug 23, 2023 · 1 comment

Comments

@wurli
Copy link

wurli commented Aug 23, 2023

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.

@wurli
Copy link
Author

wurli commented Aug 23, 2023

Closing as I forgot I already opened #140 for this exact problem 🤦

@wurli wurli closed this as completed Aug 23, 2023
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