Skip to main content
Beta
This lesson is in the beta phase, which means that it is ready for teaching by instructors outside of the original author team.
R Packaging
“An R package is a project in a standardized folder structure”
“An R package centers around R functions”
“RStudio is a useful editor that helps you package your
project”
To use a package you have to install and attach it
To use a homemade package, you also have to build it
The build, install and attach process is usually automated by
RStudio
There are several ways of installing a package
The best way of installing packages is dependent on the developer
and user needs
“A package is no more and no less than a folder structure”
“RStudio can help you”
“It is important to think about what we want our
package to do (design ) and how we want to do it
(implementation ). We also want to know why we
need a new package (avoid reinventing the wheel )”
“Functions have to be saved in .R
files in the R
folder”
A license is essential to allow the use and reuse of your
package.
The copyright holder(s) decide(s) on the license.
It is easy to add an open source license to a new R package.
Tests help you write a reliable package
A failing test provides a lot of valuable information
Checking goes deeper than testing
The DESCRIPTION
file helps us keep track of our
package’s dependencies.
Documentation is not optional
All coding projects need a readme file
roxygen2 helps us with the otherwise tedious process of
documenting
roxygen2 also takes care of NAMESPACE
R packages can also include data
Reports can be part of the package