R Package Development
Marta Bofill Roig, Pavla Krotka
r_pkg.Rmd
Why do I need to build my own package?
Packaging our functions in R packages. Why should I do it?
- is easily executable and shareable code
- makes reusable R functions
- includes documentation that describes how to use them
- makes reproducible R code
How to create an R package in 4 simple steps
- Define the working directory
filepath <- "C:/Users/pavla/Nextcloud/GitKraken/IMS-software/ToyPackage"
- Create r package folder
usethis::create_package()
- Copy in R folder the functions of the r package
- Build and check the package
devtools::build(pkg = filepath, path = NULL, binary = FALSE, manual = TRUE)
devtools::check_built(path = filepath, cran=TRUE, manual = TRUE)
devtools::build_manual(pkg = filepath, path = NULL)