Want to get started quickly? Fork this repository, rename the package, and off you go.
You could also start by creating a very basic setup running devtools::create("packageName")
, and adding other folders as required.
In order of importance.
All your wonderful code nicely organized into various scripts.
Should contain a packageName.R
file which has the info about your package and built-in datasets.
Should contain a utils.R
file with utility functions used within your code, but typically not exported. To make your life easier and the code cleaner.
Your unit tests. Your testing workflow is best managed with the package testthat
.
Your documentation is automatically put here when you run devtools::document()
.
In case your package ships one or more built-in datasets, they should be put in data. The scripts to create them, if any, can be put in data-raw.
Where you define your GitHub Actions for CI/CD pipelines.
A storage for your C++ or other low-level source code.
Files (such as how to cite your package) that become available when the package is installed go here.
- README.md
Your cool marketing material!
- DESCRIPTION
Your boring marketing material!
- .gitignore
What files to "ghost" when you push to Git(Hub).
- .Rbuildignore
What files not to consider when you build your package, and upload it to CRAN.
-
devtools::load_all()
-
devtools::document()
Generates a NAMESPACE file.
devtools::test()
Collaborate making use of the Issues tracker and a branching strategy. Doing your work out in the open is strongly encouraged!
Use the package usethis
throughout when needed.
-
devtools::check()
-
devtools::check_win_devel()
-
devtools::release()
Whatever you like, as long as it is consistent within the same package. As the main developer, don't be afraid to gently remind contributors of what the preferred style is.
Hadley Wickham's book R packages is the go-to reference.