Skip to content

DHEPLab/dhep-analysis-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Econometric Data Analysis Template Repository

Welcome to the Econometric Data Analysis Template Repository! This repository provides a reproducible workflow for econometric data analysis using R, VS Code, Conda, and Snakemake.

Getting Started

Prerequisites

Installation Steps

  1. Clone the Repository

    git clone https://github.com/your-username/econometric-analysis-template.git
    cd econometric-analysis-template
  2. Set Up Conda Environments

For R scripts:

conda env create -f envs/r_env.yaml

For Quarto rendering:

conda env create -f envs/quarto_env.yaml
  1. Initialize 'renv'

In the project directory, open R and run:

install.packages("renv")
renv::restore()
  1. Run the workflow
snakemake --use-conda --cores 1

Note: Replace --cores 1 with the number of cores you want to use.

  1. Using the Repository

Adding Data

  • Place your raw data files in the data/ directory.
  • Update data/README.md with descriptions of your datasets.

Editing Scripts

  • Modify scripts/preprocess_data.R to suit your data preprocessing needs.
  • Add additional scripts to the scripts/ directory as needed.

Editing the Quarto Document

  • Edit exploratory-analysis/analysis.qmd to include your analysis and findings.

Running the Workflow

  • Use Snakemake to automate the execution of your scripts and rendering of the Quarto document.
snakemake --use-conda --cores all

Updating Conda Environments

  • If you add new packages to your scripts, update the corresponding .yaml files in envs/ and recreate the environment:
conda env update -f envs/r_env.yaml
  • Remember to run renv::snapshot() in R to update renv.lock

Version Control with Git

  • Commit your changes regularly:
git add .
git commit -m "Your commit message"
git push origin main

Publishing with GitHub Pages

•	Enable GitHub Pages in your repository settings.
•	Commit and push your rendered HTML files to the repository.

Instructions for Students

  1. Clone the Repository

  2. Follow the Installation Steps

See the Installation Steps section.

  1. Work on Your Analysis
  • Add your data and scripts.
  • Edit the Quarto document.
  1. Run the Workflow
snakemake --use-conda --cores all
  1. Commit and Push Your Changes
git add .
git commit -m "Your commit message"
git push origin main

Additional Resources

Support

If you encounter any issues or have questions, please open an issue in the repository or contact the RA or Sean for assistance.

About

Template for reproduceable research analysis

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published