Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
39 lines (35 sloc) 2.56 KB
title: "Getting Started with R"
author: "Jason Bryer"
date: 2019-08-27
draft: false
categories: ["R"]
tags: ["R Markdown", "working directories"]
<p>To get started with the labs, you will need to install R and other supporting applications. Links to download all the software is on the <a href="/software">Software</a> page at <a href=""></a> which is available on the <code>Course Overview</code> menu. Once you are in RStudio, you will need to install a number of R packages using the following two commands:</p>
<pre><code>install.packages(c(&#39;openintro&#39;,&#39;OIdata&#39;,&#39;devtools&#39;,&#39;tidyverse&#39;, &#39;ggplot2&#39;,
<p>Note that this course used to be listed as IS 606, hence the different package name. The <code>library</code> command will load the package and the <code>startLab</code> function will:</p>
<ol style="list-style-type: decimal">
<li>Create a folder called <code>Lab1</code> in the current working directory.</li>
<li>Open the the RMarkdown file (note that the name should have your login name).</li>
<p>Note the <code>Lab1</code> directory has been created.</p>
<div class="figure">
<img src="/figures/RStudio-screen-files.png" alt="RStudio Files Panel" />
<p class="caption">RStudio Files Panel</p>
<p>If you click <code>Lab0</code> that will take you into that folder where you will see the RMardkown file (<code>.Rmd</code> extension) along with all the supporting files. Under the <code>More</code> menu there is an option to <code>Set As Working Directory</code>, you will want to do this before working in the RMarkdown file.</p>
<div class="figure">
<img src="/figures/RStudio-screen-setwd.png" alt="Setting Working Directory" />
<p class="caption">Setting Working Directory</p>
<p>The console pane will always tell you what your current working directory is. Clicking the arrow icon will open that folder in the <code>Files</code> tab on the right. R will look for files and directories that do not have absolute paths (i.e. starting with <code>C:</code> on windows or <code>/</code> on Linux and Macs) relative to the working directory.</p>
<div class="figure">
<img src="/figures/RStudio-screen-wd.png" alt="Working Directory" />
<p class="caption">Working Directory</p>
You can’t perform that action at this time.