Skip to content

Latest commit

 

History

History
78 lines (63 loc) · 3.23 KB

index.md

File metadata and controls

78 lines (63 loc) · 3.23 KB
layout title tagline description
page
R package primer
a minimal tutorial
A minimal tutorial on how to make an R package.

R packages are the best way to distribute R code and documentation, and, despite the impression that the official manual (Writing R Extensions) might give, they really are quite simple to create.

You should make an R package even for code that you don't plan to distribute. You'll find it is easier to keep track of your own personal R functions if they are in a package. And it's good to write documentation, even if it's just for your future self.

Hadley Wickham wrote a book about R packages (free online; also available in paper form from Amazon). You might just jump straight there.

Hilary Parker wrote a short and clear tutorial on writing R packages. If you want a crash course, you should start there. A lot of people have successfully built R packages from her instructions.

But there is value in having a diversity of resources, so I thought I'd go ahead and write my own minimal tutorial. The following list of topics looks forbidding, but each is short and straightforward (and hopefully clear). If you're put off by the list of topics, and you've not already abandoned me in favor of Hadley's book, then why aren't you reading Hilary's tutorial?

If anyone's still with me, the following pages cover the essentials of making an R package.

The following are important but not essential.

The following contains links to other resources:

If anything here is confusing (or wrong!), or if I've missed important details, please submit an issue, or (even better) fork the GitHub repository for this website, make modifications, and submit a pull request.


The source for this tutorial is on github.

Also see my tutorials on git/github, GNU make, knitr, making a web site with GitHub Pages, data organization, and reproducible research.