Adapted from Software Carpentry
Questions:
Objectives:
Poor organization mixes files, makes it hard to find things, and complicates sharing. Good structure:
RStudio’s project feature creates a self-contained, reproducible workspace:
Challenge 1: Create an RStudio Project
A .Rproj file will be created. Double-click it to open the project and set R’s working directory to the project folder.
Raw data is valuable and time-consuming to collect. Treat it as read-only to ensure you know the original source and all modifications made.
Store preprocessing scripts separately from raw data. Keep cleaned data in a separate output folder to avoid confusion.
Scripts should regenerate all outputs. Organize outputs by analysis type in subdirectories for easier management later.
Create separate folders for: - Reusable functions (used across analyses) - Analysis scripts (project-specific workflows)
Check your working directory:
Challenge 2: Working Directories
getwd() in the consoledata foldersetwd("data")getwd()setwd("..")