create-r-project
// Create a new R research project with standard folder structure, Git initialization, renv package management, and template scripts.
$ git log --oneline --stat
stars:1,933
forks:367
updated:March 4, 2026
SKILL.mdreadonly
SKILL.md Frontmatter
namecreate-r-project
descriptionCreate a new R research project with standard folder structure, Git initialization, renv package management, and template scripts.
Create R Research Project
A specialized sub-skill for scaffolding new R research projects with reproducible structure and best practices.
Overview
This sub-skill creates a complete, production-ready R project structure suitable for scientific research, statistical analysis, bioinformatics, and data visualization.
Use this sub-skill when the user wants to:
- Create a new R project from scratch
- Set up a reproducible research workflow
- Initialize Git for version control
- Generate analysis template scripts
What This Sub-Skill Does
When invoked, this sub-skill will:
-
Create directory structure
data/raw/- Original, immutable data filesdata/processed/- Cleaned, transformed datascripts/- Analysis and processing scriptsresults/figures/- Plots and visualizationsresults/tables/- Summary tablesresults/models/- Saved model objects (.rds files)reports/- R Markdown/Quarto documents
-
Initialize version control
- Create
.gitignorewith R-specific patterns - Initialize Git repository (if requested)
- Create initial commit with project structure
- Create
-
Set up package management
- Initialize
renvfor reproducible R environments - Create
renv.lockfile - Generate
.Rprofilefor automatic renv activation
- Initialize
-
Create RStudio project
- Generate
.Rprojfile for RStudio integration - Configure project options
- Generate
-
Generate template files
- Analysis script template (
scripts/01_analysis.R) - R Markdown report template (
reports/report.Rmd) - README.md with project documentation
.gitignorefor R projects
- Analysis script template (
Example User Requests
- "Create a new R project for genomics analysis"
- "Set up an R research project with Git"
- "Initialize an R project for differential expression analysis"
- "Create an R workflow for statistical modeling"
Generated Templates
Analysis Script (scripts/01_analysis.R)
# Load libraries
library(tidyverse)
# Add required packages
# Load data
raw_data <- read_csv("data/raw/input.csv")
# Process data
processed_data <- raw_data %>%
# Add processing steps
mutate()
# Save processed data
write_csv(processed_data, "data/processed/cleaned.csv")
# Analysis
results <- processed_data %>%
# Add analysis code
summarize()
# Save results
write_csv(results, "results/tables/results.csv")
# Generate plots
g <- ggplot(processed_data, aes()) +
geom_point() +
theme_minimal()
ggsave("results/figures/plot1.pdf", g, width = 6, height = 4)
R Markdown Report (reports/report.Rmd)
---
title: "Analysis Report"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(tidyverse)
Methods
Describe your analysis methods here.
Results
# Load and display results
results <- read_csv("results/tables/results.csv")
results
Figures
# Include generated figures
knitr::include_graphics("results/figures/plot1.pdf")
---
## Parameters
| Parameter | Description | Default |
|-----------|-------------|---------|
| `project_name` | Name of the project directory | Required |
| `init_git` | Initialize Git repository | `false` |
| `create_rproj` | Create RStudio project file | `true` |
| `init_renv` | Initialize renv environment | `true` |
| `project_type` | Type of project (general, bioinformatics, statistics) | `general` |
---
## Notes
- Project follows standard R research project conventions
- `renv.lock` ensures reproducible package versions
- `.gitignore` excludes sensitive data and compiled files
- All scripts use relative paths for portability
---
## Related Sub-Skills
- **run-analysis**: Execute analyses in created projects
- **debug-env**: Set up and troubleshoot R environments