Pane layout in RStudio

Upon opening RStudio there are some areas of interest to point out. The location of these may vary depending on whose machine you are looking at as they can be customized to personal preferences.

The RStudio interface consists of four “panes”. These panes show different types of information related to your code. Some also have their own tabs at the top that pertain to different types of information.

The "Source’ pane is the editing pane. Code is written here and can be saved as a basic R script or as an RMarkdown or other file types. Opening files opens them in this pane. When you start a new project this pane isn’t available because you don’t have a file open. Create a file and it will show up.

The “Console” pane is essentially an instance of R running within RStudio. Any commands typed here get submitted directly to R and are executed immediately. Any output from running scripts is displayed here as well. Commands/Code typed here are not saved!

Beside the “Source” pane is the “Environment” pane that contains a variety of information depending on how you configure it. Most importantly is that it displays the contents of the “Environment”. These are objects that you have created and that are available for code to act on.

In the same pane is a tab labeled “History”. This pane keeps a log of all the code that has been run during the current session. If you delete something you shouldn’t have, or didn’t save something you should have, you may be able to go to this tab and recover it.

Usually below this area is a pane with tabs such as “Files”, “Plots”, and “Packages”.

The “Files” tab is an explorer type window for file management. You can click on files there to open them. I sometimes have issues with this window refreshing when I first open a project - clicking on the two dots and then going back down to the folder resolves this.

The “Plots” tab displays any plots that you generate - “Export” on the “Plots” tab provides methods to export the last plot to different file formats.

The “Packages” tab provides a gui to install and manage packages. Its utility declines once you figure out how to install packages from the console - install.packages(“package_name”)

The “Help” tab displays help topics either searched for from within its own search bar or typed directly into the console - Typing ??dplyr will display a help file for dplyr in the “Help” pane. In most cases you can precede your search term with “??” to get help.

On this tab is “Import Dataset” as well. This is useful for loading csv and xls files without having to hand code everything - it is kind of a crutch for loading data. One caveat though, It doesn’t insert the code into your script. I use it extensively to browse to the file I’m after and enter the path and file name so I don’t have to mis-type them 3 times. Since this function builds the code as you define how you want it loaded you can then copy that code and paste it into your script so you have it the next time around.

“Running” a line of code consists of writing the code in the Source or Console pane, making sure that the cursor is within that line of code - not necessarily the physical line but within arguments of that code line, and pressing “Run” in the upper right of the “Source” pane or just hitting Ctrl-Enter. Any output generated will be displayed in the “Console” pane, objects created will appear in the “Environment” pane, and any plots generated will appear in the “Plots” pane.

tReasuRe Map 1

If your screen doesn’t look quite like mine don’t worry. First off, my interface is dark - it’s called “dark mode” - according to the interwebs using dark mode automagically makes you a better programmer, and besides, it looks cool. If you’re still not convinced, consider that “light” attracts “bugs” - it’s just common sense. I just use it because it provides more color contrast between the different types of code. You can play with different themes found under Tools/Global Options/Appearance. Another difference you may have noticed is that my panes aren’t necessarily in the same place as yours - although all of the panes are present. You can rearrange them under View/Panes/Pane Layout.