packageSkeleton

Introduction to packageSkeleton

  • packageSkeleton is a streamlined GitHub template designed to simplify R package development.
  • It also integrates with a Quarto-powered website hosted on GitHub, providing users a structured way to develop, document, and distribute their work.

Why packageSkeleton?

  • Encourages best practices in R package development
  • Provides a structure that integrates R code and documentation
  • Simplifies setting up a website for sharing your work
  • Ideal for both beginners and experienced developers

Key Features

  • R Package Template: A basic structure that you can easily customize for your package needs.
  • GitHub Integration: Fork the repository and start developing right away.
  • Quarto Documentation: Create rich, dynamic content that documents your package and provides a public-facing website.

Customizing packageSkeleton

  1. Rename the Package: Start by modifying the DESCRIPTION file and renaming the package.
  2. Add Your Own Functions: Inside the R/ directory, include your custom R functions.
  3. Generate Documentation: Use roxygen2 to create function documentation and Quarto to build your website.
  4. Deploy the Website: Publish the Quarto website using GitHub Pages.

Requirements

  • R: The latest version of R (available from CRAN)
  • Quarto: The Quarto CLI tool for building documents and websites (Install Quarto).
  • Git: Version control to manage your code and push to GitHub.
  • GitHub: Host your R package and website.

GitHub Workflow

  1. Fork the Repository: Start by forking the packageSkeleton repo from GitHub.
  2. Clone Locally: Clone the repo to your local machine using Git.
  3. Push Changes: After making your edits, push them to your GitHub repository.
  4. Deploy Website: Use GitHub Pages to host the Quarto-based documentation.

Customizing the Website

  • Quarto Configuration: Customize the _quarto.yml file to change the website settings such as title, author, and repository URL.
  • Add Pages: Create .qmd files to add custom documentation, tutorials, and more.
  • Themes & Layouts: Modify the website’s theme using CSS or choose from Quarto’s built-in themes.

Building Your Package

  • Add Functions: Use the R/ folder to store your custom R scripts and functions.
  • Generate Documentation: Write roxygen-style documentation for each function and build it using devtools::document().
  • Check Your Package: Ensure your package passes all R CMD checks by running devtools::check().

Publishing the Website

  1. Build the Website: Run quarto render to build the static HTML content.
  2. Publish on GitHub Pages: Push your changes to the repository and GitHub Pages will automatically deploy the site.
  3. Preview Locally: Use quarto preview to see live updates of the website as you edit.

Conclusion

  • packageSkeleton is a powerful starting point for R package development.
  • Use it to streamline your workflow, create well-documented R code, and publish it with a professional Quarto-powered website.
  • Leverage GitHub for collaboration, version control, and public distribution of your work.

Further Resources