Skip to content

withr

3.0.3Package record

Run Code 'With' Temporarily Modified Global State

398packages dependsuggested by 1,231
20.6Mdownloads / year
85.7%test coverage
13/13flavors OK

Overview

About

A set of functions to run code 'with' safely and temporarily modified global state. Many of these functions were originally a part of the 'devtools' package, this provides a simple package with limited dependencies to provide access to these functions.

Changes in 3.0.3
  • Fixes for CRAN checks.
  • Fixed issue that prevented local_seed() from preserving the seed (#286, @BjarkeHautop). Note: If you had before: ``r test_that("A", { withr::local_seed(1) # Seeds locally runif(...) }) test_that("B", { runif(...) # NO seed of its own }) `` Before the fix, the test "B" was accidentally seeded by "A". Now it needs to be seeded on its own.

From NEWS.md in the release

Install

Health

CRAN checks
13OK
Slowest check: 2.9 min · r-oldrel-macos-x86_64
Status changes
  • OK13 OK2026-08-04
  • NOTE12 OK, 1 NOTE2026-08-01
  • OK13 OK2026-06-22
  • ERROR13 OK, 1 ERROR2026-03-10
Advisories

none known

Documentation

In release 3.0.3
READMEYes · 597 wordsVignettesYes · 1 · dynamicNEWSYes · 100% structured · mentions 3.0.3Citation fileNoWebsiteYes · pkgdown
Help pages
28 (4 internal)includes a package overview page
Examples that run
95%20 run in a plain check · 1 never run
Exported functions with examples
77%
Documented parameters
85%
Return-value docs
81%
Help pages citing references
0%

Downloads

20.6M
CRAN downloads in the past year
Rank #10 · ~56.6K/day · ~1.7M/mo
Daily download trend is not available in this view yet.
1.7M30 days
5.3M90 days
20.6M1 year
Compare downloads with other packages →
Also on310K r2u173 autocran2.4M conda_forge25.2K c2d4u

Repository

r-lib/withr ↗Organization: r-lib
181Stars
47Forks
27Open issues
4Open PRs
17Releases
610Commits
36Commit identities
r
610 commits · Last activity 2026-10-12 · +0.6% stars, 30d · Default branch at 3.0.3.9000, ahead of CRAN 3.0.3 (checked 2026-10-18)
Responsiveness
How these are sampled
PRs merged (all time)
90%
Median days to close, 50 most recently updated closed issues
84
Median days to close, 50 most recently updated closed PRs
1

Stars over time

2025-10-20 · 1772026-10-10 · 181
PracticesBeta

12 development-tooling and community-health practices detected across 5 families in the upstream repository

Checks run against github.com/r-lib/withr on 2026-10-18.

Continuous integration (2)
GitHub ActionsR CMD check workflow

The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel

Docs source (4)
README.Rmdpkgdown

GitHub Pages site last deployed 2026-10-12 · The repository has a site deploy workflow

pkgdown site last built 2026-06-22

Coverage (2)
Coverage reporting (Codecov).covrignore
CRAN release process (2)
cran-comments.mdrevdep/
Show all practicesHide 1 practice
Lint, format, editor (2)
lintrRStudio project
How this is detected·Detection ruleset v3 (2026-09-26)

Dependencies

Declared dependencies
7 external dependencies (excludes base and recommended)

Installing withr adds no packages beyond those that come with R.

Depends (1)
R >= 3.6.0
Imports (2)
graphicsgrDevices
LinkingTo (0)
none
Enhances (0)
none

People & History

People (9)
Author, Maintainer since 2.4.3 (2021) · added in 2.4.3
Author · added in 2.0.0
Contributor · added in 2.3.0
Contributor · added in 2.1.0
Copyright holder, Funder · added in 2.5.1

Previously maintained by Jim Hester (1.0.0 to 2.4.2).

Listed in earlier versions (2)
RStudio
no longer listed · 1.0.0 to 2.5.0
Kirill M<U+00FC>ller
no longer listed · 2.0.0
Releases (20)

Pick two releases to compare their code metrics.

Show 16 earlier eventsHide 16 earlier events
  • 2.4.0
    record
    2021-01-16 · diff ↗ ·
    added 1 export
    local_seed
  • 2.3.0
    record
    2020-09-22 · diff ↗ ·
    added 3 exports
    local_makevars, local_preserve_seed, local_tempdir
  • R
    R 4.0.0 released · 2020-04-24
  • 2.2.0
    record
    2020-04-21 · diff ↗ ·
    added 8 exports
    deferred_clear, deferred_run, local_rng_version, local_timezone, makevars_user, with_rng_version, with_tempdir, with_timezone
  • R
    R 3.6.0 released · 2019-04-26
  • R
    R 3.5.0 released · 2018-04-23
  • 2.1.2
    record
    2018-03-15 · diff ↗ ·
    added 1 export
    set_makevars
  • 2.1.1
    record
    2017-12-19 · diff ↗ ·
    added 2 exports
    local_file, with_file
  • 2.1.0
    record
    2017-11-01 · diff ↗ ·
    added 32 exports
    local_bmp, local_cairo_pdf, local_cairo_ps, local_connection, local_db_connection, local_environment, local_jpeg, local_namespace, local_package, local_pdf, local_png, local_postscript, local_svg, local_tempfile, local_tiff, local_xfig, with_bmp, with_cairo_pdf, with_cairo_ps, with_connection, with_db_connection, with_environment, with_jpeg, with_namespace, with_package, with_pdf, with_png, with_postscript, with_svg, with_tempfile and 2 more
  • 2.0.0
    record
    2017-07-29 · diff ↗ ·
    added 16 exports
    defer, defer_parent, local_, local_collate, local_dir, local_envvar, local_libpaths, local_locale, local_message_sink, local_options, local_output_sink, local_par, local_path, local_temp_libpaths, with_preserve_seed, with_seed
  • R
    R 3.4.0 released · 2017-04-21
  • 1.0.2
    record
    2016-06-20 · diff ↗
  • R
    R 3.3.0 released · 2016-05-03
  • 1.0.1
    record
    2016-02-04 · diff ↗ ·
    added 2 exports
    with_message_sink, with_output_sink
  • 1.0.0
    record
    2015-09-23
  • R
    R 3.2.0 released · 2015-04-16

Package metadata

First published
2015-09-23
Total releases
20 / 11 yrs
License
MIT + file LICENSE OSI · relicensed from GPL (>= 2) in 2.4.0
Minimum R
≥ 3.6.0
Download size
102 KB

Cite

Cite this package

Run in R for the authors' preferred citation:

citation("withr")
Henry, L., Posit Software, PBC, Bryan, J., Chang, W., Cotton, R., Hester, J., Müller, K., Ushey, K., & Wickham, H. (2026). withr: Run Code 'With' Temporarily Modified Global State (Version 3.0.3) [Computer software]. https://doi.org/10.32614/CRAN.package.withr

This package has no citation file, so citation() returns this entry built from DESCRIPTION.

Cite the R Observatory

For a number measured here: a download total, a coverage figure, an archival date.

APA

Balamuta, J. J. (2026). R Observatory: Metrics for withr version 3.0.3 [Data set]. HJJB, LLC. Data release v2026-10-21. https://doi.org/10.5281/zenodo.21843040

From data release v2026-10-21, which the citation names so these numbers can be found later. More on citing and the projects behind them.

Report a problem with this page →

Privacy choices

These apply to this browser and are stored on this device only. Nothing about your choice is sent to us.

Read the privacy policy