Skip to content
Back to skills

R Cran Knowledge Patch

ASecurity

R / CRAN

  • 25 stars
  • 0 votes
  • 0 copies
  • 5 views
  • Added September 5, 2026
developmentc++nodegitapidatabasedocumentation

Works with

  • api

Security analysis

A100/100

Pro scans all 7 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add Nevaberry/nevaberry-plugins --skill r-cran-knowledge-patch --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of R Cran Knowledge Patch?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for R Cran Knowledge Patch
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nevaberry-r-cran-knowledge-patch/badge)](https://www.skillsdirectory.com/skills/nevaberry-r-cran-knowledge-patch)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: r-cran-knowledge-patch
description: R / CRAN
version: null
license: MIT
metadata:
  author: Nevaberry
---


# R and CRAN Compatibility Guidance

Use this skill when maintaining R packages, preparing CRAN submissions,
updating native code, or working with R runtime, statistics, graphics, and
documentation behavior. Load the reference for the task at hand.

| Reference | Topics |
| --- | --- |
| [CRAN policy](references/cran-policy.md) | Licensing, source distribution, dependencies, installation, storage, submission checks, reverse dependencies, maintenance |
| [Package builds and native code](references/package-build-and-native-code.md) | C++ defaults, C interfaces, experimental bindings, graphics devices, binary repositories, signing, build tools |
| [Language and runtime](references/language-and-runtime.md) | Validation, strings, sequences, tables, files, downloads, dates, S4, Tcl/Tk |
| [Statistics and graphics](references/statistics-and-graphics.md) | Model diagnostics, Wilcoxon inference, stratified tests, numerical edge cases, plotting, fonts |
| [Documentation and weaving](references/documentation-and-weaving.md) | Rd links and rendering, bibliographies, vignette engines, Sweave, LaTeX |

## Breaking changes and deprecations

### C++ builds and removed C interfaces

R selects C++20 by default when available, falls back to C++17, and requires
one of the two for C++ support. Packages that need C++17 can set
`CXX_STD = CXX17` in `src/Makevars`. Requests for C++11 or C++14 use the
default; the `CXX11` and `CXX14` families of `R CMD config` variables are defunct.

Use `Rf_isDataFrame` in place of the removed `Rf_isFrame` and include
`R_ext/ObjectTable.h` for `R_ObjectTable`. `R_ext/PrtUtil.h` is no longer
installed, and `VECTOR_PTR` is removed. Installed headers drop declarations
of `DATAPTR`, `LOGICAL0`, `INTEGER0`, `REAL0`, `COMPLEX0`, and `RAW0`.
The deprecated `CHARACTER_DATA` and `CHARACTER_POINTER` macros return const
pointers. Additional entry points, including `FRAME`, `ENCLOS`, `OBJECT`,
and `SET_BODY`, are hidden and their declarations have been removed.

`R CMD check` warns on additional non-API calls; uses of non-API variables
receive a note. The native-code reference lists the affected calls.
Use `DATAPTR_RW()` only in ALTREP `Dataptr` implementations.
Reinstall packages that provide graphics devices for graphics engine version 17.

### Runtime validation and mutation

`structure(NULL, label = "empty")` is defunct. Assigning attributes to a
primitive function raises an error; setting its environment warns and leaves
the function untouched.

`requireNamespace()` rejects invalid `versionCheck` values and unmatched
arguments even when the namespace is loaded. It returns `FALSE` when the
installed package fails the version requirement.

`cut(1:11, {})` and `all(quote(x))` raise errors. Non-ASCII abbreviations
generated by `abbreviate()` can change with wide-character case handling.

### Tcl/Tk deprecations

Treat the patch component of `tcltk::tclVersion()` as optional when parsing
versions such as `8.7a5` and `9.0b1`. The `tk*.slaves()` functions are deprecated
in favor of `tk*.child()`, which require Tcl/Tk 8.6 or later.

### Statistical and plotting behavior

`weighted.residuals()` returns weighted working residuals for GLMs;
`influence.glm()` exposes them as `wt.res` and deviance residuals as `dev.res`.
Several GLM influence measures use Pearson residuals and omit leave-one-out
dispersion estimates for fixed-dispersion models. `influence.measures()` now
picks up the changes already applied to `dffits()`, `dfbetas()`, and `covratio()`.

The Edgeworth correction in `wilcox.test(..., exact = FALSE, correct = k)`
includes the previously missing `dnorm(z)` factor for one- and two-sample
tests, changing affected approximate p-values.

`plot.lm()` omits the smoother by default in the residuals versus leverage
plot. Restore it with `plot(fit, which = 5, panel.raw = panel.smooth)`.

## CRAN submissions and maintenance

### Build and check the submitted tarball

Create the source tarball using current R-patched or the current R release,
then run `R CMD check --as-cran` on that exact tarball with current R-devel.
If R-devel is unavailable, use current R-patched or the current release and
explain the fallback in the submission.

Before an update, check reverse strong dependencies and reverse suggests,
plus their recursive strong dependencies where possible. Use
`tools::check_packages_in_dir()` with `reverse = list()` for the checks and
`tools::check_packages_in_dir_changes()` to compare check status.

```r
tools::package_dependencies(
  "ggplot2", reverse = TRUE, which = "most", recursive = "strong"
)
```

Agree on significantly disruptive changes with CRAN well before publicizing
them. For an API change affecting dependent packages, suggest changes to
their maintainers at least two weeks before submission and identify the
affected packages and outreach in the submission.

For established packages, aim to submit updates at most once every one to
two months. Wait until the CRAN check page is fully updated after publication
before submitting corrections; this can take at least 48 hours. Use
[macbuilder](https://mac.r-project.org/macbuilder/submit.html) before resubmission
if the check page shows a `macos-arm64` issue or an `M1mac` additional issue.

### Dependencies, downloads, and storage

Strong dependencies (`Depends`, `Imports`, `LinkingTo`) should be available on
CRAN or in Bioconductor's software repository. Keep orphaned CRAN packages
out of direct and transitive strong dependencies; conditional use through
`Suggests` is permitted but discouraged.

For external libraries, look for a suitably versioned installed library
first, then prefer compiling bundled source. Use a fixed source version if
it is too large to bundle and must be downloaded. Use static libraries on
Windows and macOS; obtain CRAN's agreement before downloading precompiled
software as a last resort.

Use secure transport for software or data downloads during installation or
startup, with a sufficiently long timeout for downloads larger than a few MB.
On R 4.0 or later, store user-specific data, configuration, and cache files
in their respective `tools::R_user_dir()` directories, with an R version
requirement or conditional use. Keep default storage small and actively
manage files, including removing outdated material.

## Package builds and native APIs

### Binary packages and integrity

Custom package types use `<system>.binary.<build>`: lowercase letters in
`system`, and alphanumerics or dashes in `build`.
For example, `type = "linux.binary.release"` uses `bin/linux/release/contrib/4.6`.
Binary updates consider the `Built` timestamp even when versions are identical.

`R CMD build --sha256` adds a `SHA256` manifest of hashes, lengths, and paths.
`R CMD INSTALL --build` generates it by default for binaries. For tar-based
source or binary packages, put a detached signature of the entire manifest
in `SHA256.sig`, or build and sign a binary with
`R CMD INSTALL --build --sign pkg.tar.gz`.
Installation verifies signatures with `gpg` or the command selected by `GPG`.

### Native attribute and environment access

Use `R_getAttributes` for the C equivalent of `attributes()`, or `R_mapAttrib`
to iterate over attributes. `R_getVar` and `R_getVarEx` cover most uses of
`Rf_findVar` and `Rf_findVarInFrame`. The native-code reference also covers
ALTREP class queries and the experimental C binding API.

## Runtime quick reference

| Task | Supported behavior or syntax |
| --- | --- |
| Match a literal filename pattern | `list.files(pattern = "data.csv", fixed = TRUE)` includes the dot literally. |
| Take a substring through the end | `substr()`, `substring()`, and their replacement forms accept `NULL` for the stop position. |
| Negate membership | Base R provides `%notin%`. |
| Recycle sequence inputs jointly | Opt in for `nvec`, `from`, and `by` via `R_sequence_recycle` or `recycle = TRUE`. |
| Match multiple arguments | `match.arg()` accepts `several.ok = "all"`. |
| Preserve flat-table dimension-vector names | Use `as.table(ft, named.dim = TRUE)` for the earlier naming behavior. |
| Request character counts in summaries | `summary(c("a", "b", "a"), character.method = "factor")` requests factor-style counts. |
| Change quiet behavior during a session | `--quiet` sets logical option `quiet`, which defaults to `FALSE`; use `options(quiet = TRUE)`. |
| Provide basic HTTP credentials with `libcurl` | Set `options(netrc = "/path/to/netrc")`. |

Date and date-time parsing handles character `"Inf"`. Concatenating `POSIXlt`
values preserves subsecond precision; subassignment converts incoming
timestamps to the target's time zone before inserting them.
`strptime()` ignores consecutive digits immediately after `%OS`; out-of-range
seconds parsed with `%OS` yield `NA`.

## Statistics and graphics quick reference

`wilcox.test()` can perform exact conditional inference with ties, and its
asymptotic p-values can include up to three Edgeworth correction terms.
Exact p-values near 0 or 1 are less susceptible to cancellation.

Use `stats::free1way()` for likelihood- or permutation-based inference in
distribution-free stratified K-sample one-way layouts. Use
`power.free1way.test()` for approximate power or sample-size planning,
`rfree1way()` for simulation, and `plot()` or `ppplot()` for diagnostics.

`hist()`, `barplot()`, and `bxp()` accept `panel.first`. `barplot()` and `bxp()`
also accept `panel.last`, with both hooks available through `boxplot()`.
Use `plot(x, y, lim2 = TRUE)` for default limits from observations where both
coordinates are finite, and `orderH` to sort segments within each stacked bar
by size in `barplot()`.

## Documentation and weaving quick reference

Use `\linkS4class[methods]{classRepresentation}` for class help in another
package and `\linkS4methods` for method documentation. The cross-package class
syntax requires a formal dependency such as `Depends: R (>= 4.6.0)`.
Use `\manual{R-exts}{}` to link to a manual's top, or specify a node in the
second argument. Rd citations and references can be generated from R or
BibTeX bibliographic databases.

`R CMD build` installs a package that provides its own vignette engine so the
engine is available during the build. `RweaveLatex` accepts variables from
earlier evaluated chunks for logical or numeric chunk options; `Rtangle`
warns and uses the option's default for weaving options set this way.

Set `ignore.on.weave = TRUE` to skip even parsing a chunk during weaving and
still tangle it verbatim, or `ignore.on.tangle = TRUE` to omit it from tangled
output. The aliases `weave = FALSE` and `tangle = FALSE` do the same;
`ignore = TRUE` skips both.

Files in this skill

  • SKILL.md9.7 KB
  • coverage.json491 B
  • references/cran-policy.md3.7 KB
  • references/documentation-and-weaving.md1.4 KB
  • references/language-and-runtime.md3.4 KB
  • references/package-build-and-native-code.md3.7 KB
  • references/statistics-and-graphics.md2.6 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.