README.md

How to make a package

There's not much to a package. Here are the steps to making one:

1) Clone this repo.

2) Add R functions and their roxygen2-style doccumentation to the R subdirectory. The man subdirectory has a README.md with an example of roxygen2 syntax that's adequate for most simple functions.

3) Update the DESCRIPTION file with the package name, descriptions, author(s), today's date, and any needed Depends/Suggests/Imports or other comments

4) Go to the package root directory (the one with the DESCRIPTION file) and run Rscript roxygen2::roxygenize(".") or whatever the RStudio equivalent is.

5) When roxygenize runs, it should generate a NAMESPACE file in the root directory based on instructions in the R-file comments and it should also generate documentation in the man subdirectory based on the same comments.

6) Update tests/testhat.R with the name of the package so that testthat loads the package before trying to test it. Writing and running tests is described in the R packages book,

If you scroll down there are some

Each individual test should run a small function and check that it has the correct output.

7) Then you can go to the directory above the package root and run: R CMD INSTALL <package-root>

Good policies to follow:



sakrejda/micropackage-template documentation built on May 17, 2019, 8:16 p.m.