FES 720 Introduction to R

LAB: Workspace and Files

This is the lab associated with the lecture and lesson on Workspace and Files in R.

Please upload your final completed lab on the Assignments page in Canvas, as per the instructions below.

You are welcome and expected to ask for help from the instructors if you get stuck: Please also come to the R Bootcamp on Friday!

Harry Potter Movies

In this lab, we will experiment with our new skills of creating and removing folders and files.

Note: There are no data associated with this lab.


  1. Check what your current working directory is.

  2. Set the working directory to your desktop.

  3. Create a folder called `Harry-Potter-Project’.

  4. Within `Harry-Potter-Project/’, create the separate folders: ‘Data’, ‘Rcode’, and ‘Results’.

  5. Within the Rcode folder, create a file called ‘HP-Movie-Budgets.txt’

  6. Within the Rcode folder, create a file called ‘HP-analysis.r’

  7. Move the file ‘HP-Movie-Budgets.txt’ from Rcode/ to Data/.

  8. Delete all these new folders and files and reset the working directory.

(Check that this all worked using your GUI).

How to write up your answers

You will need to write R code to answer each of the questions.

Please format your answers as follows:

It should look something like this:

# LAB: Workspace and Files
# Simon Queenborough

# 1. What year was the first Harry Potter movie released?

# 2. Assign this value to an object
x <- 2001

How to submit your answers

You are permitted to submit your answers as many times as you like within 2 weeks.

The ‘Assignments’ task in Canvas permists comments, which allows us to help each student individually.

We will comment and/or grade regularly throughout the week.

Email notifications of our comments will come in the daily Canvas email, or you can change the notification setting to reveive an email as soon as we submit a comment.

Each lab will close after 2 weeks (check the date listed on each assignment!

Final grades for that lab will then be computed and entered into the Canvas gradebook.

To submit your answers on Canvas

  1. Log into Canvas.

  2. Go to the Assignments page.

  3. Under ‘Labs’, you should find the ‘Workspace and Files’ assignment.

  4. Copy and paste your R code into the text box.

  5. Click ‘Submit Assignment’.

  6. To update your code, re-enter you code in the text box and click ‘resubmit assignment’.

Updated 2017-09-11