Separate output from console in Rstudio


#1

Is there a way in RStudio to have a separate console input and console output? In Stata, you always have your console entry visible, and the output is put into a window above. This is useful because it allows you to scroll the output of a command and then not worry about scrolling back down to input a new command.

Is this functionality feasible in Rstudio? From my perspective, it seems very desirable, but perhaps the Rstudio team chose the current layout for very good reasons.


#2

Is the History pane close enough to what you're hoping for? You can set your preferences so that it appears more prominently than in the default setup.

(I realize it's not precisely the same thing, but combined with the "Move focus to Console" keyboard command, which auto-scrolls you back to the prompt, it seems close-ish?)


#3

Ah, I will get an easier hot-key for "move focus to console". I think that is super beneficial.

But it's not entirely what I want. Say I want to write a command based on a certain value of a matrix, Stata's setup allows me to look at that matrix and write that command at the same time, which isn't possible even with a workflow that uses "move focus to console" liberally. I think this was what RCommander's goal was, and I think they were in turn inspired by Stata. Stata's workflow seems like the gold standard to me, but I understand they have a 30 year head-start.


#4

I understand what you're saying! These days, I do most of my exploratory coding in R Notebooks, which also lets you look at the output of the last iteration while you consider the next one (assuming you keep your code chunks short and sweet, which I think is good for other reasons, too...).


#5

Ah yes! I forgot that the new Jupyter Lab has exactly the kind of functionality I'm looking for! I just opened it up, and its "Console" mode separates output from input just the way I want.


#6

:grin: Ahh, the feeling of an interface that just fits.

FWIW, my sense is that longtime R users become more and more likely to be running lines of code from scripts, rather than inputting at the console — hence (I'm guessing) the default RStudio layout with prominent screen real estate for paired source and console panes. So maybe another approach to finding your comfort zone if you need to use RStudio would be to focus on the keyboard shortcuts for running different bits of code from a Source window (run selected, re-run previous, and all the different run region variants).


#7

Since I often work with Stata and R at the same time, I like to have all my scripts across all languages in the same sublime text window. Then I set both R and Stata to the same working directly and do everything with source() and do statements.

I think that the current layout helps users come into R for the first time a lot, since its an "all in one" interface, but I am not sure that a workflow with clicking "run source" is best for reproducibility, since it discourages the use of a master script to run everything. On the other hand, getting users from excel and SPSS (and Stata) to R has enormous benefits, so it's fair that the UI is designed the way it is.


#8

I tend to think that anything that pushes people towards working on a script, rather than pure interactive console use, is a win for reproducibility. So from my perspective, RStudio's prominent-source layout is way better than the typical previous situation, where newer users were usually either using R from a system command line or via one of the R GUIs, both of which interfaces tended to lead people toward exclusive interactive console use (and relying on an endlessly saved workspace image and command history to reconstruct what they did later... not to mention attach :weary:).


#9

yes! I haven't had to teach anyone R yet, so I don't have the full picture.