Loading...
Loading...
R package development with devtools, testthat, and roxygen2. Use when the user is working on an R package, running tests, writing documentation, or building package infrastructure.
npx skill4agent add posit-dev/skills r-package-development# Run code in the package
Rscript -e "devtools::load_all(); code"
# Run all tests
Rscript -e "devtools::test()"
# Run all tests for files starting with {name}
Rscript -e "devtools::test(filter = '^{name}')"
# Run all tests for R/{name}.R
Rscript -e "devtools::test_active_file('R/{name}.R')"
# Run a single test "blah" for R/{name}.R
Rscript -e "devtools::test_active_file('R/{name}.R', desc = 'blah')"
# Redocument the package
Rscript -e "devtools::document()"
# Check pkgdown documentation
Rscript -e "pkgdown::check_pkgdown()"
# Check the package with R CMD check
Rscript -e "devtools::check()"
# Format code
air format .air format .|>%>\() ...function() {...}R/{name}.Rtests/testthat/test-{name}.Rexpect_true()expect_false()expect_error()expect_warning()expect_snapshot(error = TRUE)expect_snapshot()_pkgdown.ymlpkgdown::check_pkgdown()NEWS.mdNEWS.md