Navigating R Studio for programming

Author

Silvie Cinková

Published

July 18, 2025

1 The four panes of RStudio

File, Console, Environment, and Files tabs

By default, RStudio opens with four panes. All but the top left one even have several tabs with their own menu bars. In this tutorial, I will call the panes with the names of the tabs in focus.

2 Console

  • Command line of the bare R

  • Type a command (e.g. 1 + 1) and hit Enter to execute it.

  • Console displays the output.

  • > at line start: R is ready to accept your next command

  • Console does not save your scripts. Use files to save your work.

  • Clear Console: hit the broom icon or Ctrl + L.

De-clutter the Console with the broom icon.

3 File formats for writing scripts

File formats for writing R scripts

Quarto, R Notebook, and R Markdown are markdown-based formats you have learned about. They are fantastic when you need to accompany your code with text and report the results in a single file. But not all scripts require fancy presentation. If you just want to do something quick (but still worth saving for later reuse), you may prefer the bare R Script file (.R). It comes as an empty plain text file with the .R suffix.

4 Run a script with comments

Comment your code correctly.

Highlight and run a line or several lines or source the whole file at once.

In this format, R reads each line as a command and will throw an error and stop at each line it cannot execute. When you want (you should) comment your code, you must put a fence # before the text to tell R to ignore it.

5 Environment pane

  • lists objects currently loaded in R

    • variables

    • functions you have written

  • Delete objects with the broom icon.

    • Toggle List and Grid view.

    • Grid view can mark individual objects for deletion.

Environment with objects in Grid View

What you see is the so-called Global Environment. Each software library (aka software package) that you load (more later) will create its own environment. In this course, we will only consider the Global Environment.

6 Packages pane

Installed packages You typically install packages from https://cran.r-project.org/

Install packages

A package sometimes has dependencies; i.e., requires other packages to work correctly. When you check Install dependencies, R will load all missing dependent packages automatically. CRAN is the official repository of R packages. But you can as well download a package from GitHub or elsewhere. You just adjust the source with Configuring Repositories in the Install menu.

7 Get Help

8 Plots pane

  • plots output from Console/R file
  • you can export them interactively

Plots pane