Skip to content

Latest commit

 

History

History
77 lines (46 loc) · 3.37 KB

00a-rstudio_guide.md

File metadata and controls

77 lines (46 loc) · 3.37 KB

A quick guide to RStudio

Our course material uses R Markdown Notebooks. Opening and running R Markdown (.Rmd) files requires RStudio. RStudio is an integrated development environment or IDE that makes it easier to program in R. Here, our objective is to provide a brief guide to getting started with RStudio.

Note there is an excellent Take a tour of RStudio’s IDE video from RStudio here.

Anatomy of RStudio

  1. When you open an RStudio session for the first time, it will look like this.

overview

  1. The Console is where you will type commands that will be carried out by R.

console

  1. You can switch to a Terminal where commands will be carried out by clicking the Terminal tab to the right of the Console tab. This is a command-line interface. Commands here are for programs on your system other than R.

terminal

  1. The Environment pane displays all of the objects and functions in our global environment. Here we can see that we have a data.frame called iris in our global environment.

environment

  1. You can click on iris to see what the data.frame looks like. This will open a View in the Source pane.

view

  1. The Plots pane will display any plots you make during your session. Here we've made a scatter plot with the iris data.

plots

  1. The Help pane gives you access to documentation about R packages and functions. Typing ?plot into the R Console opens up the information about this function in the Help pane.

help

  1. The Packages pane tells you what packages are installed and which version. Clicking on a package name will bring up its documentation in the Help pane.

packages

  1. The History pane displays all the commands that have been executed in R.

history

  1. The Files pane displays files for whatever directory or folder it is currently pointed at. Whatever the Files pane is pointed at is not automatically set as your working directory. Try typing ?setwd and ?getwd to learn more about working directories.

files

  1. Clicking an R Markdown file (.Rmd) in the Files pane will open it up in the Source pane. Note that the working directory for an R Notebook is automatically wherever that notebook is saved.

open-rmd

Rscript files (.R) will also open in the Source pane.

  1. If you want to adjust what is displayed or the pane layout, you can do so by clicking View > Panes > Pane Layout which will bring up an Options menu.

panes

Other resources