• R package development workshop
  • 1 R package development
    • 1.1 Info
    • 1.2 Installation
  • 2 Introduction
    • 2.1 Setup
    • 2.2 Why make an R package?
  • 3 Make a package
    • 3.1 in RStudio
    • 3.2 on your command line
    • 3.3 usethis
  • 4 Package structure
    • 4.1 Package metadata (DESCRIPTION)
    • 4.2 Code (R/)
    • 4.3 Namespaces (NAMESPACE)
    • 4.4 Object documentation (man/)
    • 4.5 Vignettes (vignettes/)
    • 4.6 Tests (tests/)
    • 4.7 Data (data/)
    • 4.8 Compiled Code (src/)
    • 4.9 Installed files (inst/)
  • 5 Functions
    • 5.1 Exercise
    • 5.2 Functions in a package
  • 6 Coding in a package
    • 6.1 Edit code, run, modify, repeat
    • 6.2 Code
      • 6.2.1 Exercise
    • 6.3 Docs
      • 6.3.1 Exercise
    • 6.4 Generate documentation
    • 6.5 Install the package
    • 6.6 Yay!
  • 7 Dependencies
    • 7.1 Adding dependencies
    • 7.2 Add a dependency to a package
      • 7.2.1 Exercise
    • 7.3 BONUS: What are system dependencies?
  • 8 Tests
    • 8.1 test infrastructure
      • 8.1.1 Exercise: set up test infrastructure
    • 8.2 write some tests
      • 8.2.1 Exercise: write tests
    • 8.3 run tests
      • 8.3.1 Exercise: run tests
    • 8.4 structure of a test file
    • 8.5 further reading
  • 9 Package checks
    • 9.1 RStudio
    • 9.2 command line
    • 9.3 the really hard way
    • 9.4 see also
  • 10 Extras
    • 10.1 License
    • 10.2 continuous integration
    • 10.3 vignettes
    • 10.4 resources
    • 10.5 CRAN/Bioconductor
  • 11 session info
  • (c) Scott Chamberlain, 2018

R package development workshop

R package development workshop

built on 2018-10-01

Chapter 1 R package development

1.1 Info

  • Code: https://github.com/PortlandRUserGroup/pkgdev/
  • Issues/Bug reports: https://github.com/PortlandRUserGroup/pkgdev/issues
  • Workshop Materials: http://portlandrusergroup.github.io/pkgdev/

Packages

  • devtools: https://cran.rstudio.com/web/packages/devtools/
  • testthat: https://cran.rstudio.com/web/packages/testthat/
  • knitr: https://cran.rstudio.com/web/packages/knitr/

1.2 Installation

Stable version from CRAN

install.packages(c("devtools", "testthat", "knitr"))

Optionally:

devtools::install_github("metacran/mason.rpkg")
devtools::install_github("metacran/mason.github")
devtools::install_github("metacran/mason")

install.packages("usethis")