| name | project-init |
| description | Initialize new economics research projects with standardized structure. Use when starting a new research project to create folder structure, configuration files, and boilerplate code. Sets up git, rix environment, Makefile, and connects to Dropbox/Overleaf. |
Project Initialization
Quick Start
Run the initialization script:
bash scripts/init_project.sh "project-name" "/path/to/projects"
Or manually create structure following the template below.
Standard Project Structure
project-name/
├── .git/
├── .gitignore
├── .here
├── CLAUDE.md # AI assistant instructions
├── Makefile
├── README.md
├── generate_env.R # rix environment definition
│
├── code/
│ ├── build/
│ │ └── .gitkeep
│ └── analysis/
│ └── .gitkeep
│
├── data/
│ ├── raw/
│ │ └── .gitkeep
│ ├── build/
│ │ └── .gitkeep
│ └── proc/
│ └── .gitkeep
│
└── output/
├── figures/
│ └── .gitkeep
├── tables/
│ └── .gitkeep
└── paper/
└── .gitkeep
Configuration Files
.gitignore
# Data
data/raw/*
data/build/*
data/proc/*
!data/*/.gitkeep
# Outputs (regenerated by code)
output/tables/*.tex
output/tables/*.html
output/figures/*.pdf
output/figures/*.png
!output/*/.gitkeep
# Nix
result
result-*
.direnv/
# R
.Rhistory
.RData
.Rproj.user/
*.Rproj
# Python
__pycache__/
*.pyc
.ipynb_checkpoints/
# Julia
*.jl.cov
*.jl.mem
# LaTeX
*.aux
*.log
*.out
*.bbl
*.blg
*.fls
*.fdb_latexmk
*.synctex.gz
# OS
.DS_Store
Thumbs.db
# Editor
*.swp
*.swo
*~
.vscode/
.idea/
generate_env.R (starter template)
library(rix)
rix(
r_ver = "4.3.2",
r_pkgs = c(
"data.table",
"here",
"fixest",
"modelsummary",
"ggplot2"
),
system_pkgs = NULL,
ide = "none",
project_path = ".",
overwrite = TRUE
)
Makefile (starter template)
.PHONY: all clean data analysis paper
all: analysis
data/proc/analysis.rds: code/build/01-build-data.R
nix-shell --run "Rscript $<"
data: data/proc/analysis.rds
output/tables/main.tex output/figures/main.pdf: code/analysis/01-main.R data/proc/analysis.rds
nix-shell --run "Rscript $<"
analysis: output/tables/main.tex
paper: output/paper/paper.pdf
output/paper/paper.pdf: output/paper/paper.qmd analysis
nix-shell --run "quarto render $<"
clean:
rm -f data/build/* data/proc/*
rm -f output/tables/* output/figures/*
Dropbox Integration
Symlink data from Dropbox
rm -rf data
ln -s ~/Dropbox/Projects/project-name/data data
Symlink output to Overleaf
rm -rf output/paper
ln -s ~/Dropbox/Apps/Overleaf/MyPaper output/paper
Git Setup
cd project-name
git init
git add .
git commit -m "Initial project structure"
git remote add origin git@github.com:username/project-name.git
git push -u origin main
Starting New Scripts
R Script Header
library(data.table)
library(here)
raw_dir <- here("data", "raw")
proc_dir <- here("data", "proc")
Julia Script Header
#=
Script: 01-estimation.jl
Purpose: [Brief description]
Author: [Name]
Date: [Date]
Inputs: data/proc/[files]
Outputs: output/[files]
=#
using DataFrames, CSV
using FixedEffectModels
using Optim
# Paths
const DATA_DIR = joinpath(@__DIR__, "..", "data", "proc")
const OUT_DIR = joinpath(@__DIR__, "..", "output")
# [Code here]
Python Notebook First Cell
"""
Notebook: 01_analysis.ipynb
Author: [Name]
Email: [Email]
Date Modified: [Date]
Description: [Brief description]
Inputs: [List inputs]
Outputs: [List outputs]
"""
import os
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
TOP_DIR = os.path.join(os.path.expanduser("~"), "Dropbox/Projects/project-name")
DATA_DIR = os.path.join(TOP_DIR, "data", "proc")
OUTPUT_DIR = os.path.join(TOP_DIR, "output")
Checklist for New Projects