Em Laskey
Em Laskey

Reputation: 607

R Studio opens data frames unprompted when running code

Since a few months ago I have a problem when using R studio: Sometimes when I run code (whole chunks or just single lines) and make changes in a data frame, R studio automatically opens the manipulated/ generated data frame, without being prompted to do so with View(dataframe) or similar. I cannot detect any patterns, i.e. it seems to happen randomly, independent of the manipulation or function used. Usually, it happens again whenever the same line is run again in the same session, but sometimes stops if the session is restarted.

I recently updated both R and R studio and use R version 4.2.3 (2023-03-15) and R studio Version 2023.03.0+386 (2023.03.0+386) on macOS 13.2.1.

Is there a way of stopping R studio from opening data frames unprompted while running a script?

Upvotes: 14

Views: 1793

Answers (1)

Earlien
Earlien

Reputation: 287

If you hold down Ctrl and click on the name of the data.frame inside an R script (i.e. Source, not Console), it will automatically run View(my.df) where my.df is the name of the data.frame.

I suspect you are accidentally pressing Ctrl as you select code containing data.frames, or you have a sticky/faulty Ctrl key (or whatever the equivalent is on Mac with your assigned keyboard shortcuts).

Upvotes: 1

Related Questions