Possible bug? RStudio opens multiple tabs

Hi there folks. Sorry to bother, can't find any hits on Google. Using RStudio/2022.12.0+353.

I have an issue that certain code combinations seem to open an uncalled-for view() of the object I'm working on. Often many of them.

Example below. See all the t's at the top? This is what opens when I run that code. Every time. What gives?

I remember having this problem in December when the update came out, so I downgraded to the previous version. But now I'm hoping to use the new version. It happens quite often actually.

Is there some setting I need to adjust by default to stop this? It's making it unusable. Not sure if it has to do with dplyr or something? Has anyone else seen or heard of this?

Thanks very much.

What else is in that code chunk? Your chunk is creating a variable called t, and something is calling View(t). It is pretty unlikely that it's RStudio, but not impossible to rule out.

Try running this command at the R console:

debugonce(View)

then running your chunk again. If something calls View(t) you'll enter the debugger with a callstack instead of getting a new data viewer tab. Does that reveal the culprit?

I, for one, had not heard of debugonce().
Turns out I should have read this: https://support.posit.co/hc/en-us/articles/205612627-Debugging-with-the-RStudio-IDE

Thanks for this idea @jonathan. Oddly, I can't replicate the problem this morning, but I know it'll be back. I'll remember to debugonce(view) and see what's up when that happens.

I have the same problem. It doesn't always occur, but quite frequently. Sometimes it opens up something like 20 tabs. My version is RStudio/2022.12.0+353 (and R version 4.2.2)

Here's an example of a code (I just ran this line using CTRL + ENTER, nothing else):

temp <- fu_data %>% filter (event = "1_year_fu")

(fu_data is my dataframe, event it's second column)
It opened 22 tabs (as if I've entered view(temp) 22 times). Very annoying.
Then I ran this:

atemp <- fu_data %>% filter (event = "1_year_fu")

No tabs were open.
Then I ran this:

temp <- fu_data %>% filter (event = "1_year_fu")

It opened 22 tabs.
Then I ran this:

atemp <- fu_data %>% filter (event = "1_year_fu")
No tabs were open.

I ran that line also directly in the Console and it also opened 22 tabs. When I renamed the variable from "temp" to "atemp" or even just "t", no tabs were open.
I ran

debugonce(view)

before and after runing

temp <- fu_data %>% filter (event = "1_year_fu")

and nothing happened. It didn't show any messages at all. Then I ran

debugonce(view)
view(temp)

And then something popped up. So I'm guessing that the bug doesn't run the view function?

Also I noticed that if I leave the 20+ tabs open, no new tabs open. Actually, as soon as I have one temp tab open, no new temp tabs open. However, as soon as I run the mentioned code (with CTRL + ENTER or in the console), the tab jumps to the open temp tab.

I often use "temp" as a variable to store items and I often have a problem of tabs opening up. For now, I'll rename all my temps to atemp as this seems to help :slight_smile:

@Sopwith Hi, this problem seems familiar with yours. May be helpful to you.

Hi @Comede_way , thanks for the reply, but I'm afraid they are very different problems. This isn't about loading old files, it's about RStudio spamming view() commands.

2 Likes

I definitely get this behavior, which I was thinking related to bind_row and it is definitely not reproducible. The following snippet opened up dozens fo tabs for the OUT and ver_dat_all objects. When I restart my session, this behavior stops for awhile.

files <- c("../data/test_train_20.csv","../data/test_train_25.csv","../data/test_train_33.csv", "../data/test_train_20_mod_pois.csv" )
OUT <- ver_dat_all <- NULL
for(i in 1:3){
  
  ver_dat <- read_csv(files[i], col_types = cols())
  ver_dat$run <- i
  ver_dat_all <- bind_rows(ver_dat_all, ver_dat)
  lin <- summary(ver_dat$pred_imps_obs -ver_dat$pred_imps_lin)
  lin$model <- "linear"
  poi <- summary(ver_dat$pred_imps_obs -ver_dat$pred_imps_pois)
  poi$model <- "poisson"
  tmp <- bind_rows(poi, lin)
  tmp$run <- i
  OUT <- bind_rows(OUT, tmp)
  
  
}

Hi @jonathan,

I finally had an instance occur where it started popping up many view() commands repeatedly for no reason, and reliably so whenever I ran a particular chunk. I ran debugonce(view) in the console and repeated my steps, sadly nothing happened. Same when I put it in the chunk. As in, nothing appeared in the console to give any information about the problem, and yet more view() tabs opened. Basically the command was seemingly of no force or effect. (The command does work though, since if I manually call view() I do get the debug viewer pop.)

I can also corroborate the various related behaviours detailed by @Tamala. Same here.

As @mjpdenver noted very well, "it is definitely not reproducible", and that's the difficulty here - I can't reliably trigger the behaviour. When I close my session and start again fresh, it typically doesn't trigger. I can go days without seeing it. Sometimes I'll see it a couple times a day out of the blue, just a single unrequestedview() tab but then nothing else. I typically then just close that tab and move on. Some rare alignment of things must be a prerequisite for the big episodes of view() spam; but once it starts, it gets quite annoying.

Is there something I can do in order to help this phantom bug get sought and slain? Export my environment, packages and build? I'd be happy to help my favourite IDE get better.

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.