Quick Recap: Creating an RStudio Project

Introduction to programming for data analysis

Author
Affiliation

Ewen Gallic

AMSE, Aix Marseille University

M1 Economics / Intro to Programming / recap-rstudio-project

project.Rproj/
  data/
    raw/

Objective of this recap

Before starting any analysis, you need a properly organized RStudio project. This short recap walks you through:

  1. creating a new RStudio project,
  2. building the standard folder structure used throughout the course.

Setup

Adopt the tree structure presented below for every new project you create in this course. Note that launching your session via project.Rproj sets your active working directory to the folder containing it.

Root/
  data/
    raw/
    tmp/
    out/
  functions/
  scripts/
  notebooks/
  figs/
  tables/
  references/
  project.Rproj

Step 1. Open RStudio

Launch RStudio on your machine.

Step 2. Create a new project

  • FileNew Project...
  • Choose New Directory
  • Name your project (e.g. session-2)

Step 3. Create the project structure

In the R console, run:

dir.create("data")
dir.create("data/raw")
dir.create("data/tmp")
dir.create("data/out")
dir.create("functions")
dir.create("scripts")
dir.create("notebooks")
dir.create("figs")
dir.create("tables")
dir.create("references")

Check your setup

Once the folders are created, you can confirm everything is in place directly from the R console:

getwd()      # should point to the folder containing project.Rproj
list.files() # should list all the folders you just created

Introduction to Programming for Data Analysis — Master 1 in Economics