Skip to content

A GitHub repository featuring a starter template for R package development, paired with a Quarto-powered website.

License

Unknown, Unknown licenses found

Licenses found

Unknown
LICENSE
Unknown
LICENSE.md
Notifications You must be signed in to change notification settings

CenterForAssessment/packageSkeleton

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

99 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

packageSkeleton

R-CMD-check CRAN_Status_Badge Development Version License

Overview

The packageSkeleton repository provides a comprehensive, production-ready template for creating professional R packages with integrated Quarto documentation websites. This skeleton eliminates the complexity of package setup by providing a fully configured development environment that includes automated testing, continuous integration, and professional documentation hostingβ€”all ready to deploy on GitHub.

Transform your R scripts and workflows into a professional, shareable package in minutes rather than hours. Whether you're consolidating personal utilities, creating tools for your team, or contributing to the open-source community, this skeleton provides everything you need to get started immediately.

πŸš€ Quick Start

  1. Use this template: Click "Use this template" on GitHub or clone this repository
  2. Rename: Replace "packageSkeleton" with your package name throughout the project
  3. Customize: Add your functions to R/, update DESCRIPTION, and modify documentation
  4. Deploy: Push to GitHub - your package website will automatically deploy via GitHub Pages

πŸ“– Detailed Setup Guide | 🌐 Live Example

πŸ“¦ What's Included

This skeleton provides a complete R package infrastructure:

Core Package Structure

packageSkeleton/
β”œβ”€β”€ R/                          # Your R functions
β”œβ”€β”€ man/                        # Auto-generated documentation
β”œβ”€β”€ vignettes/                  # Package tutorials and examples
β”œβ”€β”€ tests/                      # Automated testing framework
β”œβ”€β”€ data/                       # Package datasets
β”œβ”€β”€ DESCRIPTION                 # Package metadata
β”œβ”€β”€ NAMESPACE                   # Package namespace (auto-managed)
└── LICENSE.md                  # License information

Documentation & Website

β”œβ”€β”€ _quarto.yml                 # Website configuration
β”œβ”€β”€ index.qmd                   # Homepage content
β”œβ”€β”€ articles/                   # Vignettes and tutorials
β”œβ”€β”€ reference/                  # Function documentation
└── .github/workflows/          # Automated deployment

Development Tools

  • Automated Testing: Pre-configured testthat framework
  • CI/CD Pipeline: GitHub Actions for testing and deployment
  • Code Coverage: Integrated coverage reporting
  • Documentation: Automatic function documentation with roxygen2
  • Website Hosting: Automated Quarto website deployment to GitHub Pages
  • Package Checks: Comprehensive R CMD CHECK validation

✨ Key Features

  • Zero-Configuration Setup: Clone and start developing immediately
  • Automated Documentation: Functions documented with roxygen2 are automatically included in your website
  • Professional Styling: Clean, responsive Quarto website with modern design
  • Continuous Integration: Automated testing on multiple R versions and operating systems
  • Easy Customization: Modular structure allows easy modification of any component
  • Version Control: Git-ready with appropriate .gitignore and configuration files
  • Cross-Platform: Works seamlessly on Windows, macOS, and Linux

🎯 Perfect For

Data Scientists & Analysts

  • Personal Utility Libraries: Consolidate your frequently-used data cleaning, visualization, and analysis functions
  • Workflow Automation: Package repetitive tasks into reusable functions with professional documentation
  • Team Collaboration: Share standardized tools and methodologies across your organization

R Developers

  • Package Prototyping: Quickly test and iterate on package ideas with full infrastructure
  • Best Practices: Learn modern R package development through a well-structured example
  • Portfolio Projects: Create professional showcases of your R capabilities

Educators & Researchers

  • Course Materials: Package datasets, functions, and tutorials for students
  • Research Tools: Share reproducible analysis tools with the scientific community
  • Workshop Resources: Provide participants with ready-to-use packages and documentation

πŸ› οΈ Installation & Setup

Prerequisites

  • R (β‰₯ 4.0.0) and RStudio (recommended)
  • Git for version control
  • GitHub account for hosting and collaboration
  • Basic familiarity with R package structure

Essential R Packages

Install these packages to fully utilize the skeleton:

# Core development tools
install.packages(c("devtools", "usethis", "roxygen2", "testthat"))

# Documentation and website
install.packages(c("quarto", "pkgdown"))

Setup Steps

  1. Create your repository:

    • Click "Use this template" on the GitHub repository page
    • Name your new repository (e.g., "myAwesomePackage")
    • Clone to your local machine
  2. Customize the package:

    # In RStudio, open the project and run:
    usethis::use_description(fields = list(
      Title = "Your Package Title",
      Description = "What your package does",
      `Authors@R` = "Your Name <[email protected]> [aut, cre]"
    ))
  3. Add your content:

    • Place R functions in R/ directory
    • Add datasets to data/ directory
    • Create vignettes in vignettes/ directory
    • Write tests in tests/testthat/ directory
  4. Build and check:

    # Document functions and build package
    devtools::document()
    devtools::check()
    
    # Build website locally
    quarto::quarto_render()
  5. Deploy:

    • Push changes to GitHub
    • Enable GitHub Pages in repository settings
    • Your website will be available at https://yourusername.github.io/yourpackage

πŸ’‘ Content Ideas

Transform your R work into a professional package:

Data Manipulation Tools

# Example: Custom data cleaning functions
clean_survey_data <- function(df, remove_incomplete = TRUE) {
  # Your data cleaning logic here
}

Analysis Wrappers

# Example: Simplified statistical analysis
quick_regression <- function(data, outcome, predictors) {
  # Wrapper for common regression tasks
}

Visualization Functions

# Example: Themed plotting functions
theme_publication <- function() {
  # Custom ggplot2 theme for publications
}

Domain-Specific Tools

  • Finance: Portfolio analysis, risk calculations
  • Education: Assessment scoring, growth modeling
  • Healthcare: Clinical data processing, outcome analysis
  • Marketing: Customer segmentation, campaign analysis

πŸ”§ Advanced Features

Automated Testing

The skeleton includes a comprehensive testing framework:

# Example test structure in tests/testthat/
test_that("my_function works correctly", {
  expect_equal(my_function(2, 3), 5)
  expect_error(my_function("a", "b"))
})

Custom Documentation

Leverage roxygen2 for professional documentation:

#' Calculate Summary Statistics
#'
#' This function calculates descriptive statistics for a numeric vector.
#'
#' @param x A numeric vector
#' @param na.rm Logical, should NA values be removed?
#' @return A list of summary statistics
#' @examples
#' calc_summary(c(1, 2, 3, 4, 5))
#' @export
calc_summary <- function(x, na.rm = TRUE) {
  # Function implementation
}

Website Customization

Modify _quarto.yml to customize your site:

website:
  title: "Your Package Name"
  navbar:
    left:
      - text: "Home"
        file: index.qmd
      - text: "Reference"
        file: reference/index.qmd

🀝 Why Create an R Package?

Creating an R package isn't just for CRAN submissionsβ€”it's about building better tools for yourself and your team:

  • Efficiency: Stop copying functions between projects
  • Documentation: Force yourself to document your work properly
  • Testing: Ensure your functions work correctly across different scenarios
  • Sharing: Easily distribute your tools to colleagues and collaborators
  • Portfolio: Demonstrate your R skills professionally
  • Learning: Master R package development best practices

πŸ“š Learning Resources

πŸ†˜ Support & Contributing

  • Issues: Report bugs or request features via GitHub Issues
  • Discussions: Ask questions and share ideas in GitHub Discussions
  • Contributing: Pull requests welcome! See CONTRIBUTING.md for guidelines
  • Community: Join the broader R package development community

Ready to start building? Use this template and create your first R package today! πŸŽ‰


Produced with love ❀️❀️❀️️ by:

Damian Betebenner

Erik Whitfield

Brian Harrold

Nathan Dadey

About

A GitHub repository featuring a starter template for R package development, paired with a Quarto-powered website.

Topics

Resources

License

Unknown, Unknown licenses found

Licenses found

Unknown
LICENSE
Unknown
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •