r-package-dev

Build, 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.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "r-package-dev" with this command: npx skills add cuiweig/r-package-dev

R Package Development — CRAN & Bioconductor

Package Skeleton

usethis::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

DESCRIPTION

CRAN rules

  • Title: title case, ≤65 chars, no period
  • Description: ≥2 sentences, ends with period
  • Software names in quotes: 'CmdStan', 'OpenSSL'
  • Authors@R: use person() with aut, cre roles + ORCID
  • Imports: only packages actually called via :: or importFrom
  • Suggests: must have requireNamespace() guard in code

Bioconductor additions

  • Version: 0.99.0 for new submissions
  • biocViews: required (e.g., Genetics, Sequencing, QualityControl)
  • LazyData: false (Bioconductor requirement)
  • ≥2 Bioconductor packages in Imports
  • VignetteBuilder: knitr
  • Collate field listing all R/*.R files in dependency order

R/ Code Standards

Never use in R/ files:

ForbiddenUse instead
library() / require():: or @importFrom
T / FTRUE / 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 accessUse accessor generics
<<<-Never use global assignment
set.seed() / browser()Remove before submission

Documentation (roxygen2)

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{}.

S4 Classes (Bioconductor)

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.

Testing

devtools::test()                    # all tests
covr::package_coverage()            # target ≥80%

Test error paths with expect_error(), not just happy paths.

R CMD check

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(".")

GitHub Actions CI

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.

Visualization (publication grade)

See references/visualization.md for Nature/Science style standards.

Key rules:

  • Colorblind-safe palette: Wong (2011) Nat Methods 8:441
  • theme_classic(), no gridlines, 8pt base font
  • No titles on figures (titles go in captions)
  • Panel labels: bold lowercase a, b, c
  • Paired dot plots > bar charts for before/after comparisons

Submission

CRAN

Upload tarball to https://xmpalantir.wu.ac.at/cransubmit/ Include cran-comments.md. See references/cran.md.

Bioconductor

  1. Register at https://support.bioconductor.org (same email as DESCRIPTION)
  2. Subscribe to bioc-devel mailing list
  3. Add SSH key to GitHub
  4. Make repo Public
  5. Open issue at https://github.com/Bioconductor/Contributions/issues/new See references/bioconductor.md for the submission template.

Common Issues

See references/troubleshooting.md for solutions to frequent R CMD check and BiocCheck problems.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

Img2img

Generate images from text descriptions using DALL-E 3 while adhering to usage policies and avoiding realistic human faces.

Registry SourceRecently Updated
General

Habitat-GS-Navigator

Navigate and interact with photo-realistic 3DGS environments via the Habitat-GS Bridge. Use when: user asks to explore a 3D scene, perform embodied navigatio...

Registry SourceRecently Updated
General

Memory Palace

持久化记忆管理。Use when: 用户告诉你个人信息/偏好/习惯、需要记住项目状态/技术决策、完成任务后有可复用经验、用户说"记住""别忘了""下次注意"、需要回忆之前的对话内容。支持语义搜索和时间推理。

Registry SourceRecently Updated
General

Podcast Transcript Mining Authority Positioning

Extract guest appearances, speaking topics, and soundbites from podcast transcripts to build authority portfolios and generate podcast pitch templates. Use w...

Registry SourceRecently Updated