The purpose of this first assignment is to demonstrate that you have downloaded the “base R” and “RStudio” statistical programs and can open a SPSS datafile in RStudio.
This document was created as an R Markdown file. You will learn about R Markdown files later in the assignment. First, I want to familiarize you with the RStudio interface.
library() commands to install and load packages in R
for simple, reproducible file directory referencing
function from “haven” package, then assign it to an object in the R
environment using an assignment (
For all assignments in this class, you must have access to a computer and Microsoft Word. As a TAMUSA student you have access to the Microsoft 365 suite, which includes 1TB of storage on OneDrive. You may find instructions for how to access and install programs (such as Microsoft Word) from Microsoft 365 in the Resources & Supplemental Texts folder under the Course Content tab in Blackboard.
For this and all future assignments, I will assume you are working on your own computer and are downloading base R and RStudio (free open source) programs on your own computer. If you experience technical difficulties, remember that you can call ITS at 210-784-4357 or email them at email@example.com for help.
Also, 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).
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.
Goal: Create new CRIM5305_L_LastName folder on your local computer, then download datasets and save to your new folder (i.e., “L” for “local” computer folder).
(Note: When following instructions, always substitute “LastName” for your own last name! Also, substitute YEAR-MO-DY for the actual date. E.g., 2023-01-27_Ducate_CRIM5305_Assign01)
CRIM5305_L_LastName in a location that is easy to access
(e.g., on Desktop or in “My Documents”).
Datasets (CRIM5305_L_LastName > Datasets)
NOTE: To download, you may need to right click and select “Save link as…”
Do NOT try to open the datasets after you have downloaded them.
If your computer asks which program to open them with, press CANCEL. Do
not open them in Microsoft Word. Simply download them. We will open them
in RStudio in Part 4.
CRIM5305_L_LastName folder. Name the file:
in your cloud storage (e.g., iCloud, Dropbox, OneDrive).
If you have your cloud storage synced to your computer, you can
work out of this folder instead of your
If you choose to work out of this folder instead of your local
folder (which I recommend), be sure to copy your
folder into this folder as well.
Goal: Download R & R Studio; Open R Markdown; Knit first RMD file
In this section, you will begin by downloading and installing two programs on your computer: base 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.