local_*()functions now work when run inside of a
.Rmd. The deferred expressions are executed when knitr exits.
When supplied, this restoration pattern is used:
old <- set(new) on.exit(set(old)) action()
This ensures proper restoration of the old state when an early exit occurs during
set()(for instance when a deprecation warning is caught, see #191).
local_functions are now robust to early exits (see next bullet):
Local evaluations in the
globalenv()(as opposed to top-level ones) are now unwound in the same way as regular environments.
local_tempfile()gains a lines argument so, if desired, you can pre-fill the temporary file with some data.
CRAN release: 2021-11-30
Lionel Henry is the new maintainer.
CRAN release: 2021-04-18
enviris deprecated, in favor of
.local_envir. All withr functions except
.local_envirto specify environments, so this makes this function consistent with the rest. (#157)
CRAN release: 2021-01-16
CRAN release: 2020-09-22
local_*()functions now take dots (
...), which can simplify calls in some cases, e.g. you can now use
local_options(foo = "bar")rather than
local_options(c(foo = "bar")).
CRAN release: 2020-04-20
defer()can set deferred events on
.GlobalEnvto facilitate the interactive development of code inside a function or test. Helpers
deferred_clear()) provide a way to explicity run and clear (or just clear) deferred events (#76, @jennybc).
CRAN release: 2018-03-15
CRAN release: 2017-12-19
Fixes test failures with testthat 2.0.0
with_file()function to automatically remove files.
CRAN release: 2017-11-01
with_connection()function to automatically close R file connections.
with_db_connection()function to automatically disconnect from DBI database connections.
with_gctorture2command to run code with gctorture2, useful for testing (#47).
CRAN release: 2017-07-28
CRAN release: 2016-06-20
assignmentargument to allow specifying additional assignment types.
CRAN release: 2016-02-04