Hiding the Environment Pane and keeping it hidden

I never look at the Environment Pane.
But with some older code it takes quite a long time to refresh.
I have tried to hide it in the Pane Layout Options section. And asked for Manual Refresh only.
But it keeps coming back.
Any tips? I am on the latest version of RStudio
2022.12.0+353 "Elsbeth Geranium" Release (7d165dcfc1b6d300eb247738db2c7076234f6ef0, 2022-12-03) for Windows
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) RStudio/2022.12.0+353 Chrome/102.0.5005.167 Electron/19.1.3 Safari/537.36

I suppose if you identified a bug in how the manual refresh and hidden pane layouts dont stick, best venue to chase that is the rstudio github.

Here a potential work around you could try to adopt in case of your older code; if you wrap it in a function with some additional code at the start and end; you can call it as a function and return an environment; as the global environment isnt being touched you might avoid the performance pitfalls ?



my_old_code <- function(){
#custom beginning 
  return_env <- new.env()
  
#some `old` code
library(tidyverse)
iris2 <- head(iris) |> mutate(across(where(is.numeric),\(x)x*2))

# custom ending
items_to_return <- setdiff(ls(all.names = TRUE),"return_env")
purrr::walk(items_to_return,\(name_){
            assign(x = name_,
                   value = get(name_),
                   envir = return_env)})
return_env
}

my_results <- my_old_code()

ls(my_results)

my_results$iris2

attach(my_results)
iris2

Thanks. I'll spend some time identifying what triggers the environment display to return

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.