Is there any way to disable environment pane in RStudio?

I can reproduce the problem with lots of small nested list variables.

# Populate global environment with lots of nested list variables
invisible(
  replicate(
    1000,
    assign(
      paste0(sample(letters, 10, replace = TRUE), collapse = ""),
      list(a = 1, b = list(ba = 2.1, bb = list(bba = 2.21, bbb = 2.22))),
      envir = globalenv()
    )
  )
)

f <- function() browser()

f() # hit ENTER in the console once you hit the browser

This suggests that the problem is RStudio running its equivalent of ls.str() on the global environment.

I suspect that the behaviour is implemented in one of the functions listed by ls("tools:rstudio", all.names = TRUE), but I'm not sure which. If you find it, you can override it.

Alternatively, your best bet is to rework your code so that you aren't assigning so many variables in the global environment. Wrap most of your code into functions (so most variables only exist for the lifetime of the function call). You can also define a new environment

e <- new.env(parent = globalenv())

Then assign all your results inside e. That way the refresh only takes a few microseconds.


While it's not yet available in a public release of RStudio, the v1.3 daily builds of RStudio allow you to disable the automatic-updates of the environment pane:

Environment Pane Popup

Selecting Manual Refresh Only would disable the automatic refresh of the environment pane.

Tags:

R

Rstudio