Getting familiar with the working environment: Getting familiar with the R interface
RStudio panels
RStudio is organised into several panels. Below, you see a screenshot of how RStudio looks like when you open it on a Mac computer. Don't worry if yours looks slightly different or in case you use a MS Windows computer. The arrangement of the panels is flexible, but the look-and-feel is the same.
The different panels that you see (called panes by RStudio) each serve a specific purposes and function. Let's explore the meaning and function of the default panels that we see in the picture.
The RStudio working environment with 4 panels When you start RStudio for the first time, then you see a window that looks like the sceen shot below. The various panels that you see (called panes by RStudio) each serve a specific purposes and function.
However, in practice you almost always see 4 panels: then there is also a panel in which you can write R code. You obtain this layout with 4 panels form the previous situation with 3 panels by selecting the menu item File > New File > R Script. Then you get the window as shown in the screen shot below (on an MS Windows computer). Let's explore the meaning and function of the default panels that we see in the picture below.
-
-
Source Editor (upper-left): The Source Editor is the central panel where you write your R code. You can create, modify, and save R scripts in this panel, as will be explained in the next section.
-
Console (lower-left):The Console panel is where the result(s) of executed R code is shown. When you execute (run) a line or block of code from the Source Editor, the results will be displayed in the Console. It also allows interactive execution of commands and displays the R output, error messages, and warnings. More about those later!
-
Environment/History (upper-right): The Environment/History panel displays information about the objects (no worries, we cover these later) currently present in your R workspace. It shows the data and variables that you have defined during your session. The History tab provides a record of previously executed commands.
-
Files/Plots/Packages/Help (lower-right): These panels consist of multiple tabs:
- Files: It provides a file browser to navigate through your computer's directories/folders and to access files for loading into R.
- Plots: When you create plots or graphs, they will be displayed in this panel.
- Packages: This tab allows you to manage R packages installed on your system, load them into the current session, or install new packages.
- Help: It shows the documentation and information about R functions and packages.
Now you can resize, move, or close individual panels to create a layout that suits your workflow. -