Introduction to Quantitative Methods

How to Set Working Directory

We recommend that you create a PUBLG100 folder for all your work. Create this folder on N: drive if you're using a UCL computer or somewhere on your local disk if you're using a personal laptop.

Once the folder is created, use the setwd() function or RStudio menu to set your working directory.

1. Using the setwd() Function

Recommended Folder Location R Function
UCL Computers N: Drive setwd("N:/PUBLG100")
Personal Laptop (Windows) C: Drive setwd("C:/PUBLG100")
Personal Laptop (Mac) Home Folder setwd("~/PUBLG100")

2. Using RStudio Menu

You can also set the working directory using the menu in RStudio.

Notice that RStudio itself uses the setwd() function to set the working directory.

After you've set the working directory, verify it by calling the getwd() function.