Packages (How to make them?)

Buy me a coffeeBuy me a coffee


Create your own R package-R Packages

By Hadley Wickham Jennifer Bryan

What is this?

Excerpt from e-book: Packages are the fundamental units of reproducible R code. They include reusable R functions, the documentation that describes how to use them, and sample data. In this book you’ll learn how to turn your code into packages that others can easily download and use. Writing a package can seem overwhelming at first. So start with the basics and improve it over time. It doesn’t matter if your first version isn’t perfect as long as the next version is better.

  1. Link to e-book here: https://r-pkgs.org/

How to write your own R package and publish it on CRAN

By Cosima Meyer

Added Fri Apr 28th, 2023

What is this?
Excerpt from site: While there exist many great resources for learning how to write a package in R, we found it difficult to find one all-encompassing guide that is also easily accessible for beginners. This tutorial seeks to close this gap: we will provide you with a step-by-step guide — seasoned with new and helpful packages that are also inspired by presentations at the recent virtual European R Users Meeting e-Rum 2020.

  1. Link to the datasets: https://www.mzes.uni-mannheim.de/socialsciencedatalab/article/r-package/

R Packages

By Hadley Wickham

What is this?

Excerpt from e-book: Writing a package can seem overwhelming at first. So start with the basics and improve it over time. It doesn’t matter if your first version isn’t perfect as long as the next version is better.

This is the work-in-progress 2nd edition of the book.

  1. Link to ebook here: https://r-pkgs.org/
  2. Purchase book HERE

R package primer a minimal tutorial

By Karl Broman

What is this?

Minimal tutorial about how to write your very own R package.

  1. Link to tutorial here: https://kbroman.org/pkg_primer/
  2. Link to repo here: https://github.com/kbroman/pkg_primer

rjtools: Preparing, Checking, and Submitting Articles to the ‘R Journal’

By Di Cook

Added Fri Apr 14th, 2023

What is this?

Excerpt from vignette: Create an ‘R Journal’ ‘Rmarkdown’ template article, that will generate html and pdf versions of your paper. Check that the paper folder has all the required components needed for submission. Examples of ‘R Journal’ publications can be found at https://journal.r-project.org.

  1. Link to package vignette here: https://cran.r-project.org/web/packages/rjtools/index.html
  2. Link to package manual here: https://cran.r-project.org/web/packages/rjtools/rjtools.pdf

Understanding the Basics of Package Writing in R

By Cosima Meyer

Added Fri Apr 28th, 2023

What is this?
Excerpt from site: Writing a package sounds big - and it can for sure be. But in its simplest form, it's not that much more than putting a function in a package structure. The R community is great and came up with multiple great helpers that make your life easier!

  1. Link to the datasets: https://cosimameyer.com/post/understanding-the-basics-of-package-writing-in-r/

Writing an R package from scratch

By Hilary Parker

What is this?

Excerpt from blog: This tutorial is not about making a beautiful, perfect R package. This tutorial is about creating a bare-minimum R package so that you don’t have to keep thinking to yourself, “I really should just make an R package with these functions so I don’t have to keep copy/pasting them like a goddamn luddite.” Seriously, it doesn’t have to be about sharing your code (although that is an added benefit!). It is about saving yourself time. (n.b. this is my attitude about all reproducibility)

  1. Link to blog: https://hilaryparker.com/2014/04/29/writing-an-r-package-from-scratch/