Skip to content

Override View() to support memoised functions #140

@wurli

Description

@wurli

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)
  ))
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions