Loading...
Loading...
Prepare R packages for CRAN submission by checking for common ad-hoc requirements not caught by devtools::check(). Use when: (1) Preparing a package for first CRAN release, (2) Preparing a package update for CRAN resubmission, (3) Reviewing a package to ensure CRAN compliance, (4) Responding to CRAN reviewer feedback. Covers documentation requirements, DESCRIPTION field standards, URL validation, examples, and administrative requirements.
npx skill4agent add posit-dev/skills cran-extrachecksdevtools::check()usethis::use_news_md()usethis::use_cran_comments()install.packages("pkgname")devtools::build_readme()Title:Description:@return@examplesAuthors@R:[cph]urlchecker::url_check()@return@return@keywords internal@return None# Missing @return - WILL BE REJECTED
#' Calculate sum
#' @export
my_sum <- function(x, y) {
x + y
}
# Correct - includes @return
#' Calculate sum
#' @param x First number
#' @param y Second number
#' @return A numeric value
#' @export
my_sum <- function(x, y) {
x + y
}
# For functions with no return value
#' Print message
#' @param msg Message to print
#' @return None, called for side effects
#' @export
print_msg <- function(msg) {
cat(msg, "\n")
}@examples@examples@keywords internal:::pkg:::my_fun()@noRd.Rd\dontrun{}\dontrun{}try()googlesheets4::sheets_has_token()if ()interactive()\donttest{}# BAD - Will be rejected
#' @examples
#' # my_function(x) # Don't do this!@examplesIf#' @examplesIf rlang::is_installed("dplyr")
#' library(dplyr)
#' my_data %>% my_function()#' @examples
#' if (rlang::is_installed("dplyr")) {
#' library(dplyr)
#' my_data %>% my_function()
#' }tools::toTitleCase()# BAD
Title: A Toolkit for the Construction of Modeling Packages for R
# GOOD
Title: Construct Modeling Packages
# BAD
Title: Command Argument Parsing for R
# GOOD
Title: Command Argument Parsing# GOOD
Title: Interface to 'Tiingo' Stock Price API# BAD
Description: This package provides functions for rendering slides.
Description: Functions for rendering slides to different formats.
# GOOD
Description: Render slides to different formats including HTML and PDF.# BAD (too short)
Description: Render slides to different formats.
# GOOD
Description: Render slides to different formats including HTML and PDF.
Supports custom themes and progressive disclosure patterns. Integrates
with 'reveal.js' for interactive presentations. Designed for technical
presentations and teaching materials.# BAD
Description: Uses 'case_when()' to process data.
# GOOD
Description: Uses case_when() to process data with 'dplyr'.# BAD
Description: Implements X-SAMPA processing.
# GOOD
Description: Implements Extended Speech Assessment Methods Phonetic
Alphabet (X-SAMPA) processing.# BAD
Description: Handles dates like "the first Monday of December".
# GOOD
Description: Handles dates like the first Monday of December.https://# BAD
URL: http://paleobiodb.org/
# GOOD
URL: https://paleobiodb.org/Found the following (possibly) invalid URLs:
URL: https://h3geo.org/docs/core-library/coordsystems#faceijk-coordinates
(moved to https://h3geo.org/docs/core-library/coordsystems/)# Find redirecting URLs
urlchecker::url_check()
# Automatically update to final destinations
urlchecker::url_update()https://cran.r-project.org/package=pkgnamehttps://www.r-pkg.org/badges/version/pkgnamehttps://cranchecks.info/badges/pkgnameurlchecker::url_check()Found the following (possibly) invalid file URI:
URI: CODE_OF_CONDUCT.md
From: README.md.Rbuildignore.Rbuildignoreusethis::use_code_of_conduct()[cph]# Required
Authors@R: person("John", "Doe", role = c("aut", "cre", "cph"))Authors@R: c(
person("Jane", "Doe", role = c("aut", "cre"),
email = "jane.doe@posit.co"),
person("Posit Software, PBC", role = c("cph", "fnd"),
comment = c(ROR = "03wc8by49"))
)# If LICENSE shows 2024 but submitting in 2026
# Update: 2024 → 2026If there are references describing the methods in your package, please add these in the description field...
cran-comments.md## Method References
There are no published references describing the methods in this package.
The package implements original functionality for [brief description].@return@examples@examplesIf@noRddevtools::build_readme()# Before
Title: A Toolkit for the Construction of Modeling Packages for R
# After
Title: Construct Modeling Packages# Before
Description: This package provides functions for rendering slides.
# After
Description: Render slides to different formats including HTML and PDF.
Supports custom themes and progressive disclosure. Integrates with
'reveal.js' for interactive presentations.# Before - Missing @return
#' Calculate total
#' @param x Values
#' @export
calc_total <- function(x) sum(x)
# After - Complete documentation
#' Calculate total
#' @param x Numeric values to sum
#' @return A numeric value representing the sum
#' @examples
#' calc_total(1:10)
#' @export
calc_total <- function(x) sum(x)tools::toTitleCase()urlchecker::url_check()urlchecker::url_update()usethis::use_news_md()usethis::use_cran_comments()devtools::build_readme()usethis::use_code_of_conduct()usethis::use_build_ignore()usethis::use_package()usethis::use_tidy_description()NEWS.mdcran-comments.mddevtools::build_readme()install.packages("pkgname")Title:Title:Title:Title:Description:Description:Description:Description:Description:Authors@R:[cph]person("Posit Software, PBC", role = c("cph", "fnd"), comment = c(ROR = "03wc8by49"))@return@examples\dontrun{}@examplesIfif:::@noRdurlchecker::url_check().Rbuildignorecran-comments.md