An package is the fundamental unit of shareable code R. Packages bundle together code, data, documentation, and tests in a redefined template. When build a package is easy to share with others.
Writing R extensions is the official manual and reference for package development, but can be a challenging read. A more accessible description is given in R Packages book. The dynatop development broadly follows the philosophy of expressed in the book that “anything that can be automated, should be automated” though not always using the tools used in the book (particularly RStudio projects).
A high degree of automation in the package building is achieved though the use of further R packages, particularly devtools which can be install with
install.packages(c("devtools", "roxygen2", "testthat", "knitr", "rmarkdown", "bookdown"))
The following screen shot shows the contents of the cloned dynatop directory
Briefly the directories contain:
Key files within the folder include:
Open up the xts_utilities.R file in the R folder. The contents will looks similar to
The initial lines beginning #'
contains material
processed by the roxygen2
package to produce the function documentation.
The files in the vignettes folder are written in Rmarkdown which can be build in different ways to produce responsive documents or websites such as the dynatop website - or this training course.