Q&A 1 How do you create a project directory ready for analysis?
1.1 Explanation
Before working with data, it’s important to set up a clean and organized project directory. A consistent folder structure helps you manage scripts, datasets, and outputs across both Python and R — making your work easier to follow and share.
In this guide, we’ll create a root directory called general-data-science with four folders:
data/– for datasets
scripts/– for code files
images/– for plots and charts
library/– for reusable functions
Example Folder Structure:
general-data-science/
├── data/
├── scripts/
├── images/
└── library/
1.4 R Code
Here’s how to do it in R:
folders <- c("data", "scripts", "images", "library")
root <- "general-data-science"
if (!dir.exists(root)) dir.create(root)
for (folder in folders) {
dir.create(file.path(root, folder), showWarnings = FALSE)
}
cat("Created", root, "project folder with subdirectories.\n")✅ A clean project directory helps you stay organized, reuse code, and avoid errors — it’s the first step toward reproducible, professional data science.