Install
openclaw skills install r-package-devBuild, check, and submit R packages to CRAN or Bioconductor. Use when creating a new R package from scratch, fixing R CMD check errors/warnings, preparing for CRAN or Bioconductor submission, setting up GitHub Actions CI for R packages, writing S4 classes extending Bioconductor containers (SummarizedExperiment, GRanges), adding roxygen2 documentation with @references and DOIs, or debugging BiocCheck issues. Covers both CRAN and Bioconductor workflows with real submission experience.
openclaw skills install r-package-devusethis::create_package("~/mypkg")
usethis::use_mit_license("Author Name") # CRAN
# OR: License: Artistic-2.0 # Bioconductor standard
usethis::use_testthat()
usethis::use_vignette("introduction")
usethis::use_readme_md()
usethis::use_news_md()
Required: DESCRIPTION, NAMESPACE, LICENSE, NEWS.md, README.md, .Rbuildignore, .gitignore
Authors@R: use person() with aut, cre roles + ORCID:: or importFromrequireNamespace() guard in code0.99.0 for new submissionsbiocViews: required (e.g., Genetics, Sequencing, QualityControl)LazyData: false (Bioconductor requirement)VignetteBuilder: knitrNever use in R/ files:
| Forbidden | Use instead |
|---|---|
library() / require() | :: or @importFrom |
T / F | TRUE / FALSE |
sapply() | vapply() (type-safe) |
1:length(x) | seq_along(x) / seq_len(n) |
cat() / print() | message() (except in show methods) |
options() / par() | Never modify global state |
@slot direct access | Use accessor generics |
<<<- | Never use global assignment |
set.seed() / browser() | Remove before submission |
Every @export function must have:
@param for all arguments@return describing the return value@examples that run in <5 seconds@references with DOIs for methods: \doi{10.xxxx/yyyy}Use \donttest{} for slow examples. Never \dontrun{}.
For infrastructure packages extending Bioconductor classes:
# Define generic — this is the extension point
setGeneric("myFunction", function(x, ...)
standardGeneric("myFunction"))
# Define method for your class
setMethod("myFunction", "MyClass", function(x, ...) {
# implementation
})
Key principle: analytical operations should be generics, not plain functions. This lets downstream packages specialize behavior for their own classes. See references/bioconductor.md.
devtools::test() # all tests
covr::package_coverage() # target ≥80%
Test error paths with expect_error(), not just happy paths.
rcmdcheck::rcmdcheck(
args = c("--no-manual", "--as-cran"),
error_on = "warning"
)
For Bioconductor, also run:
BiocCheck::BiocCheck("pkg_0.99.0.tar.gz", `new-package` = TRUE)
BiocCheck::BiocCheckGitClone(".")
See references/github-actions.md for platform-specific configs.
CRAN packages: use r-lib/actions standard workflow.
Bioconductor packages: use r-lib/actions/setup-r-dependencies
which auto-resolves Bioc deps from DESCRIPTION.
See references/visualization.md for Nature/Science style standards.
Key rules:
theme_classic(), no gridlines, 8pt base fontUpload tarball to https://xmpalantir.wu.ac.at/cransubmit/
Include cran-comments.md. See references/cran.md.
See references/troubleshooting.md for solutions to frequent R CMD check and BiocCheck problems.