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.
- Git: Install Git
- Anaconda or Miniconda: Install Miniconda
- VS Code: Install VS Code
- Quarto: Install Quarto
- R: Install R
-
Clone the Repository
git clone https://github.com/your-username/econometric-analysis-template.git cd econometric-analysis-template
-
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
- Initialize 'renv'
In the project directory, open R and run:
install.packages("renv")
renv::restore()
- Run the workflow
snakemake --use-conda --cores 1
Note: Replace --cores 1 with the number of cores you want to use.
- 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.
-
Clone the Repository
-
Follow the Installation Steps
See the Installation Steps section.
- Work on Your Analysis
- Add your data and scripts.
- Edit the Quarto document.
- Run the Workflow
snakemake --use-conda --cores all
- Commit and Push Your Changes
git add .
git commit -m "Your commit message"
git push origin main
- Conda Documentation: https://docs.conda.io/en/latest/
- Snakemake Documentation: https://snakemake.readthedocs.io/
- R renv Package: https://rstudio.github.io/renv/
- Quarto Documentation: https://quarto.org/docs/
- VS Code R Extension Guide: Using R in VS Code
If you encounter any issues or have questions, please open an issue in the repository or contact the RA or Sean for assistance.