12 Next Steps
You’ve got your R package built, and while it is simple, it does contain all the core pieces of an R package! Here are some next steps that I would recommend you pursue to make your R package even better.
- Use continuous integration, so every code push runs checks and tests
- Add a website with pkgdown
- Put your R package on the R Universe
- Put your package on CRAN
12.0.1 Using Continuous Integration
It’s nice to run tests and checks locally, but we can actually set things up to happen automatically every time we push to GitHub.
To do this, run:
# (singular, not plural)
use_github_action()
And follow the prompts
- This is all much easier than it used to be
- There is a bit of a game of “watching the green lights”
- Add test coverage
- see
covr::report()
for a local version
- see
12.1 Adding a website with pkgdown
We’ve got our package written! Now let’s make it even more attractive to users by making a fancy website.
This has now been made so easy thanks to pkgdown
. Essentially, you run:
`use_pkgdown_github_pages()`
And you follow the steps from here.
Some tips for structure your R Package website:
look at other packages for inspiration on structure
try to use a different default theme
R packages book
official R docs
rOpenSci docs
R Package Essentials
12.1.1 R Universe
R Universe presents a middle ground between your package on github, and your package on CRAN.
- See https://r-universe.dev/search
- Similar to CRAN - you get speed of builds thanks to binary builds.
- Linked to your github
- Fewer barriers to entry
- Learn more at https://docs.r-universe.dev/publish/set-up.html
12.1.2 Publish to CRAN
Before you publish on CRAN, you will need to go through some more hoops. I would recommend at least skim reading the R packages book: https://r-pkgs.org/
- A few barriers
- very stable, fast
- Requires constant maintenance from you - usually need to respond to CRAN requests within 2 weeks
- I would recommend reading https://r-pkgs.org/release.html