3  Tour

Author

Jarad Niemi

The RStudio Desktop integrated development environment (IDE) provides functionality through several panes and tabs within those panes. The tabs in each pane are highlighted using red boxes in Fig Figure 3.1 while the RStudio projects functionality is highlighted with a red oval.

A diagram pointing out the different pains and tabs in RStudio.
Figure 3.1: RStudio Panes and Tabs

3.1 Tabs

Here we briefly introduce each tab in RStudio. These tabs and the panes that they exist within can be customized to user preference.

3.1.1 Console

The console is where R commands are excited and the results of those commands show up. We will use the Console extensively throughout the semester.

3.1.2 Terminal

The Terminal tab provides an interface to the command line for your operating system, e.g. Terminal on a Mac and CMD Prompt on a Windows machine. This terminal can be used, for example, to compile a quarto document to HTML.

3.1.3 Background Jobs

The Background Jobs tab provides details about any jobs being run in the background show up here. We will likely not use this command at all.

3.1.4 Environment

The Environment tab provides information about any objects you have created during your R session. It provides the object name as well as some basic details about the object that will depend on the type of object.

3.1.5 History

The History tab provides the history of commands that have been entered in this and previous R sessions. A convenient way of accessing this history is to use the up and down arrow keys on your keyboard. Using these arrows will reduce typing and increase speed of analysis.

3.1.6 Connections

The Connections tab provides information about databases that your R session is connected to. This will not be used in this course, but may be very helpful later in your career.

3.1.7 Tutorial

The Tutorial tab provides a beginning look at R through the learnr package. This can be used as a complement to this course.

3.1.8 Files

The Files tab provides access to the filesystem on your computer. From this tab you can create, delete, rename, move, abd copy files and folders.

3.1.9 Plots

The Plots tab provides any plots that have been constructed during your R session. To see a plot, run the following code

hist(rnorm(1e3))

3.1.10 Packages

The Packages tab lists all the packages that have been installed on your system. The far left column indicates which packages have been attached to the current R session.

3.1.11 Help

The Help tab provides access to the Help menus available within R. Two primary ways of obtain help are 1) opening the help file for a known R function and 2) searching for a keyword to identify the appropriate help file.

?mean
??mean # OR 
help.search("mean")

3.1.12 Viewer

The Viewer tab provides an interface to HTML output. While this can be useful initially, we suggest you open HTML in a browser.

3.1.13 Presentation

The Presentation tab provides an interface to presentations that have been compiled. While this can be useful initially, we suggest you open presentations in a browser.

3.2 Files

When you open a file, perhaps through the Files tab, a new pane will open up with that file. As additional files are opened up, new tabs will be available with the filenames indicated.

These files may be

  • R scripts,
  • text files, e.g. README files,
  • data files, e.g. csv files, and
  • quarto documents,

As a general rule, we suggest you get in the habit of developing R code by writing in a script and executing from that script.

3.3 Projects

RStudio projects are a tremendously helpful way to organize your work. They allow you to quickly switch back and forth to between different projects, e.g. classes, research, website, etc.

When you switch from one project to the other, the RStudio session will

  • rstart the R session,
  • close open scripts,
  • open scripts that we open the last time you were in that project, and
  • change your working directory to the root directory of the project.