13  Adding a README file

Now that we’ve got our package onto github, let’s add a nice landing page, in the form of a README file.

A README for a package should aim to answer the following questions:

We can set up the README with the following command:

use_readme_rmd()

Which tells us the following:

✔ Writing README.Rmd.
✔ Adding "^README\\.Rmd$" to .Rbuildignore.
☐ Modify README.Rmd.
✔ Writing .git/hooks/pre-commit.

Essentially this means:

Here’s a commit of this

Essentially, the README.Rmd file allows us to demonstrate our package - in a similar way to how we have a vignette.

Some good examples of R package READMEs:

13.0.1 How to write the README, though?

Writing documentation can be a bit hard, but here are some general tips:

  • Take the vignette, make it smaller.
  • Take the examples, put them in there.
  • Remember that done is better than perfect.

Here’s my (quick) commit of making a minimal README.Rmd

A common pitfall with README.Rmd
  • Remember to add library(pkg) to your README
  • Remember to build the package before you knit!
    • You can do this with build_readme() (which builds the package and knits the README file)