Two main resources :

A quick, start-from-scratch guide : https://r-mageddon.netlify.com/post/writing-an-r-package-from-scratch/

Step by step, comprehensive reference : http://r-pkgs.had.co.nz/

Be aware that new tools become available, so advice on good practice can change over time.

An R package :

3 'levels' of package :

  1. a personal package saved only on your local machine

  2. a package saved on github (no checks or rules for submission)

    • can be installed by anyone (if it works!)
  3. a package submitted to CRAN

    • has to go through checks
    • can be installed by anyone

packages to help you make packages

usethis

automates creation of package components (relatively new)

devtools

essential tools for package development

roxygen2

allows you to create documentation files for packages by putting comments into the code files themselves. This is MUCH better than writing documentation files separately because if you do that the code and documentation INEVITABLY diverge.



AndySouth/rmapteach documentation built on May 5, 2019, 6:01 a.m.