Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
37 lines (33 sloc) 2.46 KB
title: "Getting Started with R"
author: "Jason Bryer"
date: 2018-01-29
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="" class="uri"></a> which is available on the <code>Misc</code> menu. Once you are in RStudio, you will need to install a number of R packages using the following two commands:</p>
<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>Lab0</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>Lab0</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>