R Observatory
Search
install.packages("withr")
CRAN 30-day downloads, method
1.7M−4.6% down on the 30 days before, the worse direction
Dependent packages, method
4021,256 more suggest it
Test coverage, method
86%of lines run by tests

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.

Maintainer
Lionel Henry
Latest release
19 Jun 2026
First release
23 Sep 2015

Compare with another package

More details
Releases
20
Needs compilation
No
Needs R
>= 3.6.0
Config/Needs/website
tidyverse/tidytemplate
Config/testthat/edition
3
RoxygenNote
7.3.2
Task views (1)
Cite

Package

Run in R for the authors' preferred citation:

citation("withr")
APA
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
About

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

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-28. https://doi.org/10.5281/zenodo.21843040
About

From data release v2026-10-28, which the citation names so these numbers can be found later.

All 13 check platforms pass.

  • r-devel-linux-x86_64-debian-clang

    The unreleased R on Linux, x86_64, debian-clang

    OK

    Version checked
    3.0.3
    Time taken
    54 s
  • r-devel-linux-x86_64-debian-gcc

    The unreleased R on Linux, x86_64, debian-gcc

    OK

    Version checked
    3.0.3
    Time taken
    41 s
  • r-devel-linux-x86_64-fedora-clang

    The unreleased R on Linux, x86_64, fedora-clang

    OK

    Version checked
    3.0.3
    Time taken
    44 s
  • r-devel-linux-x86_64-fedora-gcc

    The unreleased R on Linux, x86_64, fedora-gcc

    OK

    Version checked
    3.0.3
    Time taken
    41 s
  • r-devel-windows-x86_64

    The unreleased R on Windows, x86_64

    OK

    Version checked
    3.0.3
    Time taken
    116 s
  • r-oldrel-macos-arm64

    The previous release of R on macOS, arm64

    OK

    Version checked
    3.0.3
    Time taken
    68 s
  • r-oldrel-macos-x86_64

    The previous release of R on macOS, x86_64

    OK

    Version checked
    3.0.3
    Time taken
    172 s
  • r-oldrel-windows-x86_64

    The previous release of R on Windows, x86_64

    OK

    Version checked
    3.0.3
    Time taken
    102 s
  • r-patched-linux-x86_64

    The patched release of R on Linux, x86_64

    OK

    Version checked
    3.0.3
    Time taken
    47 s
  • r-release-linux-x86_64

    The current release of R on Linux, x86_64

    OK

    Version checked
    3.0.3
    Time taken
    46 s
  • r-release-macos-arm64

    The current release of R on macOS, arm64

    OK

    Version checked
    3.0.3
    Time taken
    59 s
  • r-release-macos-x86_64

    The current release of R on macOS, x86_64

    OK

    Version checked
    3.0.3
    Time taken
    170 s
  • r-release-windows-x86_64

    The current release of R on Windows, x86_64

    OK

    Version checked
    3.0.3
    Time taken
    88 s
  • 13 OK

Over time

No change since 4 Aug 2026

As a list (4)
ChangedWorst statusOKNotesWarningsErrors
4 Aug 2026OK13000
1 Aug 2026Note12100
22 Jun 2026OK13000
10 Mar 2026Error13001

Since March 2026

Check results on CRAN

Total downloads in the last 30 days
2,119,117+2% up on the 30 days before, the better directionIt is the sum of 5 channels: CRAN, r2u, autoCRAN, conda-forge and c2d4u.

CRAN rank

10 of 26,530

CRAN

1,680,287 downloads in the last 30 days

Rank
10 of 26,530
Change
−4.6% down on the 30 days before, the worse direction

It is in the total. Take it out

r2u

65,667 downloads in the last 30 days

Rank
5 of 30,526
Change
+97.8% up on the 30 days before, the better direction

It is in the total. Take it out

autoCRAN

181 downloads in the last 30 days

Rank
304 of 29,212
Change
+17.5% up on the 30 days before, the better direction

It is in the total. Take it out

conda-forge

371,496 downloads in the last 30 days

Rank
7 of 3,828
Change
+31.4% up on the 30 days before, the better direction

It is in the total. Take it out

c2d4u, no longer updated

1,486 downloads in the last 30 days

Rank
7 of 7,575
Change
−11.3% down on the 30 days before, the worse direction

It is in the total. Take it out

Over time

Compare downloads

Needs
2
Dependent packages
402
Suggested by
1,256
Needs (2)
  • graphics
  • grDevices
Installing it adds
0 packages, 0 KB of source
Of those, need compilation
0
Optional extras (8)
Dependent packages (50 of 402)
PackageTitleDownloads in 30 days
ggplot2Create Elegant Data Visualisations Using the Grammar of Graphics2,045,465
tidyselectSelect from a Set of Strings1,083,931
shinyWeb Application Framework for R805,266
readrRead Rectangular Text Data748,734
testthatUnit Testing for R705,742
vroomRead and Write Rectangular Text Data Quickly651,792
gargleUtilities for Working with Google APIs434,630
googledriveAn Interface to Google Drive428,479
googlesheets4Access Google Sheets using the Sheets API V4424,676
dbplyrA 'dplyr' Back End for Databases420,795
reprexPrepare Reproducible Example Code via the Clipboard407,766
forecastForecasting Functions for Time Series and Linear Models393,489
ggrepelAutomatically Position Non-Overlapping Text Labels with 'ggplot2'391,619
httr2Perform HTTP Requests and Process the Responses364,590
devtoolsTools to Make Developing R Packages Easier303,016
ggridgesRidgeline Plots in 'ggplot2'280,433
roxygen2In-Line Documentation for R278,755
ggdistVisualizations of Distributions and Uncertainty223,566
usethisAutomate Package and Project Setup220,769
rexFriendly Regular Expressions215,107
pkgdownMake Static HTML Documentation for a Package202,899
reticulateInterface to 'Python'173,357
covrTest Coverage for Packages159,843
rcmdcheckRun 'R CMD check' from 'R' and Capture Results128,477
recipesPreprocessing and Feature Engineering Steps for Modeling127,390
downlitSyntax Highlighting and Automatic Linking125,812
caretClassification and Regression Training118,662
ggforceAccelerating 'ggplot2'93,113
DescToolsTools for Descriptive Statistics63,537
ggraphAn Implementation of Grammar of Graphics for Graphs and Networks63,253
stylerNon-Invasive Pretty Printing of R Code53,382
chromoteHeadless Chrome Web Browser Interface48,283
RPostgresC++ Interface to PostgreSQL47,865
torchTensors and Neural Networks with 'GPU' Acceleration43,771
yardstickTidy Characterizations of Model Performance30,960
cyclocompCyclomatic Complexity of R Code29,995
workflowsModeling Workflows28,685
dialsTools for Creating Tuning Parameter Values25,896
inferTidy Statistical Inference25,860
tuneTidy Tuning Tools24,325
sparklyrR Interface to Apache Spark24,101
learnrInteractive Tutorials for R22,431
workflowsetsCreate a Collection of 'tidymodels' Workflows20,166
shinytest2Testing for Shiny Applications18,487
mockrMocking in R17,220
FSASimple Fisheries Stock Assessment Methods16,205
themisExtra Recipes Steps for Dealing with Unbalanced Data11,613
readODSRead and Write ODS Files10,569
fmesherTriangle Meshes and Related Geometry Tools10,233
DBItestTesting DBI Backends8,299
Functions
119
Public exports
79
Lines of R code
2,548
Median complexity
1
Functions (119)
Size and composition

Lines by kind (6,575)

KindLinesShare
R code2,54839%
Tests2,07632%
Documentation1,60824%
Guides3435%

Lines by language

LanguageLinesShare
R4,52069%
Rd1,60825%
Vignettes3435%
Markdown1042%

Languages are counted from file extensions.

Files
110
R functions
119
Deprecated functions
2
Complexity
Median
1
Mean
2.09
Highest
13
Median lines per function
7
About complexity

Cyclomatic complexity counts the independent paths through a function: 1 is a straight line, higher is harder to test. R functions only.

Call graph figures
R functions
119
Calls
129
Unconnected
14
Groups
3
Growth (20 releases)
Total lines by release
1,037 on 23 Sep 20156,575 on 19 Jun 2026
Release changes

The tests ran and coverage was measured.

Lines run by tests
85.7%
Expressions run by tests
85.7%
Test cases
140
Exports named in tests
88.6%
Coverage by file (27)
Coverage run
Lines counted
750
Lines the tests ran
643
Tests passed
Yes
Measured with
covr 3.6.5 on R 4.6.1
Test suite
Has tests
Yes
Test frameworks
testthat, tinytest
Test cases
140
Snapshot tests
10
Lines of tests
2,076
Test lines per line of code
0.81
Exports documented
100%
Arguments documented
85.1%
Return value documented
80.8%
Help pages with examples
75%
Examples run in checks
95.2%
Guides (1)
Other documentation
README
Yes, 597 words
Release notes file
Yes
Help pages
28
Lines of documentation
1,608

Funded by Posit Software, PBC

Earlier names (1)
  • RStudio

r-lib / withr on github.com

Stars
181+0.56% up on 30 days ago, the better direction
Forks
47
Open issues
27
Last commit
12 Oct 2026
Activity
Commits
610
Open pull requests
4
Tagged releases
17
Latest tagged release
v3.0.3, 22 Jun 2026
In development
Default branch at 3.0.3.9000, ahead of CRAN 3.0.3 (checked 2026-10-25)
Issues closed in
84 days (median)
Pull requests closed in
1 day (median)
Pull requests merged
90%
Created
21 Apr 2015
Licence file reads as
–
Development practices (12)
KindFound
Continuous integrationGitHub Actions, R CMD check workflow
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
Docs sourceREADME.Rmd, pkgdown
GitHub Pages site last deployed 2026-10-12
The repository has a site deploy workflow
pkgdown site last built 2026-06-22
CoverageCoverage reporting (Codecov), .covrignore
CRAN release processcran-comments.md, revdep/
Lint, format, editorlintr, RStudio project

Method, repository practices

Across r-lib

R releases
  • On CRAN
  • Release
VersionReleasedREvents
3.0.3 current19 Jun 20264.6.0
3.0.228 Oct 20244.4.1
3.0.131 Jul 20244.4.1
3.0.016 Jan 20244.3.2
2.5.230 Oct 20234.3.1
2.5.126 Sep 20234.3.1
2.5.03 Mar 20224.1.2
2.4.330 Nov 20214.1.2Maintainer: Lionel Henry
Earlier versions (12)
VersionReleasedREvents
2.4.218 Apr 20214.0.5
2.4.126 Jan 20214.0.3
2.4.016 Jan 20214.0.3Licence: MIT + file LICENSE
2.3.022 Sep 20204.0.2
2.2.021 Apr 20203.6.3
2.1.215 Mar 20183.4.4
2.1.119 Dec 20173.4.3
2.1.01 Nov 20173.4.2
2.0.029 Jul 20173.4.1
1.0.220 Jun 20163.3.0
1.0.14 Feb 20163.2.3
1.0.023 Sep 20153.2.2

Relicensed from GPL (>= 2) in version 2.4.0.

Release notes (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.