Assumptions & Ground Rules

(Note: This document was created as an R Markdown file. You will learn about R Markdown files later. First, I want to familiarize you with the RStudio interface.)

The purpose of this first assignment is to demonstrate that you have downloaded the “R” statistical program and the “RStudio” Integrated Development Environment (IDE).

For all assignments in this class, you must have access to a computer and should also use Microsoft OneDrive at UNCW, the recommended UNCW cloud-based file systems. Working from cloud storage is essential - and not just for this class! By saving and backing up using cloud storage, you will be able to access your saved files from any computer, you will still have access to your saved files if your computer were to unfortunately stop working, and you can easily share files and folders with collaborators.

Thus, for this and all future assignments, I will assume you are working on your own computer, are downloading base R and RStudio (free open source) programs on your own computer, and are working from your Microsoft OneDrive cloud storage via your computer’s [Windows] file explorer (Windows or MAC). If you experience technical difficulties, remember that you can contact TAC for help.

  • If you do not have access to your own computer or cannot download R/RStudio, you should be able to access the software on any computer on or off UNCW’s campus via Horizon.

  • Whether you download R or access it elsewhere (e.g., via Horizon), the remainder of the steps must be completed on a computer for grading purposes.

    • Important: For this and all future assignments, you MUST type all commands in by hand. Do not copy & paste except for troubleshooting purposes (i.e., if you cannot figure out what you mistyped). Trust me - you will learn better from typing.

    • Early on, you may have a lot of trouble getting your code to run due to minor typos. This is normal. Remember, you are learning to read and write a new (coding) language. As with learning any new languages, we learn from practice - and from correcting our mistakes.

Part 1 (Assignment 1.1)

Goal: Create new LastName_CRM495_work folder in your OneDrive cloud storage

(Note: When following instructions, always substitute “LastName” for your own last name! Also, substitute YEAR_MO_DY for the actual date. E.g., **Day_CRM495_RAssign1_2022_01_1)

  1. On your computer, navigate to your OneDrive folder, then create a new folder called “LastName_CRM495_work” in a location that is easy to access (e.g., in the root OneDrive folder).

  2. Create two new folders in your CRM495_work folder: a “Datasets” folder (LastName_CRM495_work > Datasets) and an “Assignments” folder (LastName_CRM495_work > Assignments).

    • You will use these folders in later assignments.
  3. Open a Word document. At the top, put your name, date, course information (SP22-CRM495; Day), and heading (Assignment 1). Then, create a subheading for Part 1 (e.g., Assignment 1.1).

  4. Take a screenshot (#1) of your new LastName__work folder with the “Datasets” and “Assignment” folders and paste into the word document.

    • PC: ctrl + prt sc then ctrl + P into a Word document underneath the subheading for Part 1. Or, in the search bar type in “snipping tool” and use the tool to take a snapshot of your Datasets folder.

    • Mac: Command + shift + 3, this saves on your desktop. Then, paste into the Word document under the Part 1 subheading.

  5. Save the Word document with your screenshot to your “LastName_CRM495_work > Assignments” folder. Name the file: LastName_CRM495_RAssign1_YEAR_MO_DY (e.g., I would name my assignment: Day_CRM495_RAssign1_2022_01_20).

Completing Assignment 1.1

Completing Assignment 1.1

Part 2 (Assignment 1.2)

Goal: Download R & RStudio; Configure and Familiarize yourself with RStudio.

In this section, you will begin by downloading and installing two programs on your computer: R and RStudio.The first program, R, is simultaneously a computer coding language and a statistical software program. The second, RStudio, is an integrated development environment (IDE) that provides a more user-friendly interface for working with the R program. Throughout this course, you will learn to write and submit R code in RStudio to run statistical commands in the R program. After installing R & RStudio, you will run some simple commands to familiarize yourself with the basic features of the program and install two R packages.

  1. I recommend following along with Danielle Navarro’s videos for for installing R and R Studio in Windows or on a Mac.

    • Alternatively, you could also follow the instructions here.

    • Antoine Soetewe’s blog entry, particularly the section titled “Main Components of RStudio” will also guide you through the process.

  2. At the top of RStudio, navigate to “Tools” then click “Global Options” and change the following settings:

    • Uncheck “Restore .RData into workspace at startup”

    • Change “Save workspace to .RData on exit” to “Never”

    • Uncheck both boxes under “History”

    • Uncheck “Restore most recently opened project at startup”

    • Uncheck “Restore previously open source documents at startup.”

Our goal is to write and save standalone reproducible code that can be run at any time by anyone with the file and associated file structure. In my experience, these options aid in pursuit of that goal while minimizing headaches when collaborating with others using shared drives. For additional information, see Section 4.5 in Nicholas Tierney’s R Markdown for Scientists.