renv/ 0000755 0001762 0000144 00000000000 14606061022 011221 5 ustar ligges users renv/NAMESPACE 0000644 0001762 0000144 00000003356 14464550375 012467 0 ustar ligges users # Generated by roxygen2: do not edit by hand
export(activate)
export(autoload)
export(checkout)
export(clean)
export(config)
export(consent)
export(deactivate)
export(dependencies)
export(diagnostics)
export(embed)
export(equip)
export(history)
export(hydrate)
export(init)
export(install)
export(isolate)
export(load)
export(lockfile_create)
export(lockfile_modify)
export(lockfile_read)
export(lockfile_write)
export(migrate)
export(modify)
export(paths)
export(project)
export(purge)
export(rebuild)
export(record)
export(refresh)
export(rehash)
export(remove)
export(repair)
export(restore)
export(revert)
export(run)
export(sandbox)
export(scaffold)
export(settings)
export(snapshot)
export(status)
export(update)
export(upgrade)
export(use)
export(use_python)
importFrom(tools,file_ext)
importFrom(tools,pskill)
importFrom(tools,psnice)
importFrom(tools,write_PACKAGES)
importFrom(utils,Rprof)
importFrom(utils,URLencode)
importFrom(utils,adist)
importFrom(utils,available.packages)
importFrom(utils,browseURL)
importFrom(utils,citation)
importFrom(utils,contrib.url)
importFrom(utils,download.file)
importFrom(utils,download.packages)
importFrom(utils,file.edit)
importFrom(utils,getCRANmirrors)
importFrom(utils,head)
importFrom(utils,help)
importFrom(utils,install.packages)
importFrom(utils,installed.packages)
importFrom(utils,modifyList)
importFrom(utils,old.packages)
importFrom(utils,packageDescription)
importFrom(utils,packageVersion)
importFrom(utils,read.table)
importFrom(utils,remove.packages)
importFrom(utils,sessionInfo)
importFrom(utils,str)
importFrom(utils,summaryRprof)
importFrom(utils,tail)
importFrom(utils,tar)
importFrom(utils,toBibtex)
importFrom(utils,untar)
importFrom(utils,unzip)
importFrom(utils,update.packages)
importFrom(utils,zip)
renv/LICENSE 0000644 0001762 0000144 00000000061 14606007442 012231 0 ustar ligges users YEAR: 2024
COPYRIGHT HOLDER: Posit Software, PBC
renv/README.md 0000644 0001762 0000144 00000007124 14605660506 012517 0 ustar ligges users
# renv
[](https://lifecycle.r-lib.org/articles/stages.html)
[](https://CRAN.R-project.org/package=renv)
[](https://github.com/rstudio/renv/actions)
## Overview
The renv package[^1] helps you create **r**eproducible **env**ironments
for your R projects. Use renv to make your R projects more isolated,
portable and reproducible.
- **Isolated**: Installing a new or updated package for one project
won’t break your other projects, and vice versa. That’s because renv
gives each project its own private library.
- **Portable**: Easily transport your projects from one computer to
another, even across different platforms. renv makes it easy to
install the packages your project depends on.
- **Reproducible**: renv records the exact package versions you depend
on, and ensures those exact versions are the ones that get installed
wherever you go.
## Installation
Install the latest version of renv from CRAN with:
``` r
install.packages("renv")
```
## Workflow
Use `renv::init()` to initialize renv in a new or existing project. This
will set up a **project library**, containing all the packages you’re
currently using. The packages (and all the metadata needed to reinstall
them) are recorded into a **lockfile**, `renv.lock`, and a `.Rprofile`
ensures that the library is used every time you open that project.
As you continue to work on your project, you will install and upgrade
packages, either using `install.packages()` and `update.packages` or
`renv::install()` and `renv::update()`. After you’ve confirmed your code
works as expected, use `renv::snapshot()` to record the packages and
their sources in the lockfile.
Later, if you need to share your code with someone else or run your code
on new machine, your collaborator (or you) can call `renv::restore()` to
reinstall the specific package versions recorded in the lockfile.
## Learning more
If this is your first time using renv, we strongly recommend starting
with the [Introduction to
renv](https://rstudio.github.io/renv/articles/renv.html) vignette: this
will help you understand the most important verbs and nouns of renv.
If you have a question about renv, please first check the
[FAQ](https://rstudio.github.io/renv/articles/faq.html) to see whether
your question has already been addressed. If it hasn’t, please feel free
to ask on the [Posit Forum](https://forum.posit.co).
If you believe you’ve found a bug in renv, please file a bug (and, if
possible, a [reproducible example](https://reprex.tidyverse.org)) at
.
[^1]: Pronounced “R” “env”
renv/man/ 0000755 0001762 0000144 00000000000 14573145613 012010 5 ustar ligges users renv/man/snapshot.Rd 0000644 0001762 0000144 00000015660 14475733536 014156 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/snapshot.R
\name{snapshot}
\alias{snapshot}
\title{Record current state of the project library in the lockfile}
\usage{
snapshot(
project = NULL,
...,
library = NULL,
lockfile = paths$lockfile(project = project),
type = settings$snapshot.type(project = project),
dev = FALSE,
repos = getOption("repos"),
packages = NULL,
exclude = NULL,
prompt = interactive(),
update = FALSE,
force = FALSE,
reprex = FALSE
)
}
\arguments{
\item{project}{The project directory. If \code{NULL}, then the active project will
be used. If no project is currently active, then the current working
directory is used instead.}
\item{...}{Unused arguments, reserved for future expansion. If any arguments
are matched to \code{...}, renv will signal an error.}
\item{library}{The \R libraries to snapshot. When \code{NULL}, the active \R
libraries (as reported by \code{.libPaths()}) are used.}
\item{lockfile}{The location where the generated lockfile should be written.
By default, the lockfile is written to a file called \code{renv.lock} in the
project directory. When \code{NULL}, the lockfile (as an \R object) is returned
directly instead.}
\item{type}{The type of snapshot to perform:
\itemize{
\item \code{"implict"}, (the default), uses all packages captured by \code{\link[=dependencies]{dependencies()}}.
\item \code{"explicit"} uses packages recorded in \code{DESCRIPTION}.
\item \code{"all"} uses all packages in the project library.
\item \code{"custom"} uses a custom filter.
}
See \strong{Snapshot type} below for more details.}
\item{dev}{Boolean; include development dependencies? These packages are
typically required when developing the project, but not when running it
(i.e. you want them installed when humans are working on the project but
not when computers are deploying it).
Development dependencies include packages listed in the \code{Suggests} field
of a \code{DESCRIPTION} found in the project root, and roxygen2 or devtools if
their use is implied by other project metadata. They also include packages
used in \verb{~/.Rprofile} if \code{config$user.profile()} is \code{TRUE}.}
\item{repos}{The \R repositories to be recorded in the lockfile. Defaults
to the currently active package repositories, as retrieved by
\code{getOption("repos")}.}
\item{packages}{A vector of packages to be included in the lockfile. When
\code{NULL} (the default), all packages relevant for the type of snapshot being
performed will be included. When set, the \code{type} argument is ignored.
Recursive dependencies of the specified packages will be added to the
lockfile as well.}
\item{exclude}{A vector of packages to be explicitly excluded from the lockfile.
Note that transitive package dependencies will always be included, to avoid
potentially creating an incomplete / non-functional lockfile.}
\item{prompt}{Boolean; prompt the user before taking any action? For backwards
compatibility, \code{confirm} is accepted as an alias for \code{prompt}.}
\item{update}{Boolean; if the lockfile already exists, then attempt to update
that lockfile without removing any prior package records.}
\item{force}{Boolean; force generation of a lockfile even when pre-flight
validation checks have failed?}
\item{reprex}{Boolean; generate output appropriate for embedding the lockfile
as part of a \href{https://www.tidyverse.org/help/#reprex}{reprex}?}
}
\value{
The generated lockfile, as an \R object (invisibly). Note that
this function is normally called for its side effects.
}
\description{
Call \code{renv::snapshot()} to update a \link{lockfile} with the current state of
dependencies in the project library. The lockfile can be used to later
\link{restore} these dependencies as required.
It's also possible to call \code{renv::snapshot()} with a non-renv project,
in which case it will record the current state of dependencies in the
current library paths. This makes it possible to \link{restore} the current packages,
providing lightweight portability and reproducibility without isolation.
If you want to automatically snapshot after each change, you can
set \code{config$config$auto.snapshot(TRUE)}, see \code{?config} for more details.
}
\section{Snapshot types}{
Depending on how you prefer to manage dependencies, you might prefer
selecting a different snapshot mode. The modes available are as follows:
\describe{
\item{\code{"implicit"}}{
(The default) Capture only packages which appear to be used in your project,
as determined by \code{renv::dependencies()}. This ensures that only the packages
actually required by your project will enter the lockfile; the downside
if it might be slow if your project contains a large number of files.
If speed becomes an issue, you might consider using \code{.renvignore} files to
limit which files renv uses for dependency discovery, or switching to
explicit mode, as described next.
}
\item{\code{"explicit"}}{
Only capture packages which are explicitly listed in the project
\code{DESCRIPTION} file. This workflow is recommended for users who wish to
manage their project's \R package dependencies directly.
}
\item{\code{"all"}}{
Capture all packages within the active \R libraries in the lockfile.
This is the quickest and simplest method, but may lead to undesired
packages (e.g. development dependencies) entering the lockfile.
}
\item{\code{"custom"}}{
Like \code{"implicit"}, but use a custom user-defined filter instead. The filter
should be specified by the \R option \code{renv.snapshot.filter}, and should
either be a character vector naming a function (e.g. \code{"package::method"}),
or be a function itself. The function should only accept one argument (the
project directory), and should return a vector of package names to include
in the lockfile.
}
}
You can change the snapshot type for the current project with \code{\link[=settings]{settings()}}.
For example, the following code will switch to using \code{"explicit"} snapshots:
\if{html}{\out{
}}
When the \code{packages} argument is set, \code{type} is ignored, and instead only the
requested set of packages, and their recursive dependencies, will be written
to the lockfile.
}
\examples{
\dontrun{
# disable automatic snapshots
auto.snapshot <- getOption("renv.config.auto.snapshot")
options(renv.config.auto.snapshot = FALSE)
# initialize a new project (with an empty R library)
renv::init(bare = TRUE)
# install digest 0.6.19
renv::install("digest@0.6.19")
# save library state to lockfile
renv::snapshot()
# remove digest from library
renv::remove("digest")
# check library status
renv::status()
# restore lockfile, thereby reinstalling digest 0.6.19
renv::restore()
# restore automatic snapshots
options(renv.config.auto.snapshot = auto.snapshot)
}
}
\seealso{
More on handling package \code{\link[=dependencies]{dependencies()}}
Other reproducibility:
\code{\link{lockfiles}},
\code{\link{restore}()}
}
\concept{reproducibility}
renv/man/install.Rd 0000644 0001762 0000144 00000013101 14565235355 013745 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/install.R
\name{install}
\alias{install}
\title{Install packages}
\usage{
install(
packages = NULL,
...,
exclude = NULL,
library = NULL,
type = NULL,
rebuild = FALSE,
repos = NULL,
prompt = interactive(),
dependencies = NULL,
verbose = NULL,
lock = FALSE,
project = NULL
)
}
\arguments{
\item{packages}{Either \code{NULL} (the default) to install all packages required
by the project, or a character vector of packages to install. renv
supports a subset of the remotes syntax used for package installation,
e.g:
\itemize{
\item \code{pkg}: install latest version of \code{pkg} from CRAN.
\item \code{pkg@version}: install specified version of \code{pkg} from CRAN.
\item \code{username/repo}: install package from GitHub
\item \code{bioc::pkg}: install \code{pkg} from Bioconductor.
}
See \url{https://remotes.r-lib.org/articles/dependencies.html} and the examples
below for more details.
renv deviates from the remotes spec in one important way: subdirectories
are separated from the main repository specification with a \code{:}, not \code{/}.
So to install from the \code{subdir} subdirectory of GitHub package
\code{username/repo} you'd use \verb{"username/repo:subdir}.}
\item{...}{Unused arguments, reserved for future expansion. If any arguments
are matched to \code{...}, renv will signal an error.}
\item{exclude}{Packages which should not be installed. \code{exclude} is useful
when using \code{renv::install()} to install all dependencies in a project,
except for a specific set of packages.}
\item{library}{The \R library to be used. When \code{NULL}, the active project
library will be used instead.}
\item{type}{The type of package to install ("source" or "binary"). Defaults
to the value of \code{getOption("pkgType")}.}
\item{rebuild}{Force packages to be rebuilt, thereby bypassing any installed
versions of the package available in the cache? This can either be a
boolean (indicating that all installed packages should be rebuilt), or a
vector of package names indicating which packages should be rebuilt.}
\item{repos}{The repositories to use when restoring packages installed
from CRAN or a CRAN-like repository. By default, the repositories recorded
in the lockfile will be, ensuring that (e.g.) CRAN packages are
re-installed from the same CRAN mirror.
Use \code{repos = getOption("repos")} to override with the repositories set
in the current session, or see the \code{repos.override} option in \link{config} for
an alternate way override.}
\item{prompt}{Boolean; prompt the user before taking any action? For backwards
compatibility, \code{confirm} is accepted as an alias for \code{prompt}.}
\item{dependencies}{A vector of DESCRIPTION field names that should be used
for package dependency resolution. When \code{NULL} (the default), the value
of \code{renv::settings$package.dependency.fields} is used. The aliases
"strong", "most", and "all" are also supported.
See \code{\link[tools:package_dependencies]{tools::package_dependencies()}} for more details.}
\item{verbose}{Boolean; report output from \verb{R CMD build} and \verb{R CMD INSTALL}
during installation? When \code{NULL} (the default), the value of \code{config$install.verbose()}
will be used. When \code{FALSE}, installation output will be emitted only if
a package fails to install.}
\item{lock}{Boolean; update the \code{renv.lock} lockfile after the successful
installation of the requested packages?}
\item{project}{The project directory. If \code{NULL}, then the active project will
be used. If no project is currently active, then the current working
directory is used instead.}
}
\value{
A named list of package records which were installed by renv.
}
\description{
Install one or more \R packages, from a variety of remote sources.
\code{install()} uses the same machinery as \code{\link[=restore]{restore()}} (i.e. it uses cached
packages where possible) but it does not respect the lockfile, instead
installing the latest versions available from CRAN.
See \code{vignette("package-install")} for more details.
}
\section{\code{Remotes}}{
\code{install()} (called without arguments) will respect the \code{Remotes} field
of the \code{DESCRIPTION} file (if present). This allows you to specify places
to install a package other than the latest version from CRAN.
See \url{https://remotes.r-lib.org/articles/dependencies.html} for details.
}
\section{Bioconductor}{
Packages from Bioconductor can be installed by using the \verb{bioc::} prefix.
For example,
\if{html}{\out{
}}
will install the latest-available version of Biobase from Bioconductor.
renv depends on BiocManager (or, for older versions of \R, BiocInstaller)
for the installation of packages from Bioconductor. If these packages are
not available, renv will attempt to automatically install them before
fulfilling the installation request.
}
\examples{
\dontrun{
# install the latest version of 'digest'
renv::install("digest")
# install an old version of 'digest' (using archives)
renv::install("digest@0.6.18")
# install 'digest' from GitHub (latest dev. version)
renv::install("eddelbuettel/digest")
# install a package from GitHub, using specific commit
renv::install("eddelbuettel/digest@df55b00bff33e945246eff2586717452e635032f")
# install a package from Bioconductor
# (note: requires the BiocManager package)
renv::install("bioc::Biobase")
# install a package, specifying path explicitly
renv::install("~/path/to/package")
# install packages as declared in the project DESCRIPTION file
renv::install()
}
}
renv/man/equip.Rd 0000644 0001762 0000144 00000001042 14441721610 013406 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/equip.R
\name{equip}
\alias{equip}
\title{Install required system libraries}
\usage{
equip()
}
\value{
This function is normally called for its side effects.
}
\description{
Equip your system with libraries commonly-used during compilation of
base and recommended \R packages. This was previously useful with older
versions of R on windows, but is no longer terribly helpful.
}
\examples{
\dontrun{
# download useful build tools
renv::equip()
}
}
\keyword{internal}
renv/man/init.Rd 0000644 0001762 0000144 00000007705 14575106076 013255 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/init.R
\name{init}
\alias{init}
\title{Use renv in a project}
\usage{
init(
project = NULL,
...,
profile = NULL,
settings = NULL,
bare = FALSE,
force = FALSE,
repos = NULL,
bioconductor = NULL,
load = TRUE,
restart = interactive()
)
}
\arguments{
\item{project}{The project directory. When \code{NULL} (the default), the current
working directory will be used. The \R working directory will be
changed to match the requested project directory.}
\item{...}{Unused arguments, reserved for future expansion. If any arguments
are matched to \code{...}, renv will signal an error.}
\item{profile}{The profile to be activated. See
\code{vignette("profiles", package = "renv")} for more information.}
\item{settings}{A list of \link{settings} to be used with the newly-initialized
project.}
\item{bare}{Boolean; initialize the project with an empty project library,
without attempting to discover and install \R package dependencies?}
\item{force}{Boolean; force initialization? By default, renv will refuse
to initialize the home directory as a project, to defend against accidental
misusages of \code{init()}.}
\item{repos}{The \R repositories to be used in this project.
See \strong{Repositories} for more details.}
\item{bioconductor}{The version of Bioconductor to be used with this project.
Setting this may be appropriate if renv is unable to determine that your
project depends on a package normally available from Bioconductor. Set this
to \code{TRUE} to use the default version of Bioconductor recommended by the
BiocManager package.}
\item{load}{Boolean; should the project be loaded after it is initialized?}
\item{restart}{Boolean; attempt to restart the \R session after initializing
the project? A session restart will be attempted if the \code{"restart"} \R
option is set by the frontend hosting \R.}
}
\value{
The project directory, invisibly. Note that this function is normally
called for its side effects.
}
\description{
Call \code{renv::init()} to start using renv in the current project. This will:
\enumerate{
\item Set up project infrastructure (as described in \code{\link[=scaffold]{scaffold()}}) including
the project library and the \code{.Rprofile} that ensures renv will be
used in all future sessions,
\item Discover the packages that are currently being used in your project
(via \code{\link[=dependencies]{dependencies()}}), and install them into the project library
(as described in \code{\link[=hydrate]{hydrate()}}),
\item Create a lockfile that records the state of the project library so it
can be restored by others (as described in \code{\link[=snapshot]{snapshot()}}),
\item Restart R (if running inside RStudio).
}
If you call \code{renv::init()} with a project that is already using renv, it will
attempt to do the right thing: it will restore the project library if it's
missing, or otherwise ask you what to do.
}
\section{Repositories}{
If the default \R repositories have not already been set, renv will use
the \href{https://packagemanager.posit.co/}{Posit Public Package Manager} CRAN
mirror for package installation. The primary benefit to using this mirror is
that it can provide pre-built binaries for \R packages on a variety of
commonly-used Linux distributions. This behavior can be configured or
disabled if desired -- see the options in \code{\link[=config]{config()}} for more details.
}
\examples{
\dontrun{
# disable automatic snapshots
auto.snapshot <- getOption("renv.config.auto.snapshot")
options(renv.config.auto.snapshot = FALSE)
# initialize a new project (with an empty R library)
renv::init(bare = TRUE)
# install digest 0.6.19
renv::install("digest@0.6.19")
# save library state to lockfile
renv::snapshot()
# remove digest from library
renv::remove("digest")
# check library status
renv::status()
# restore lockfile, thereby reinstalling digest 0.6.19
renv::restore()
# restore automatic snapshots
options(renv.config.auto.snapshot = auto.snapshot)
}
}
renv/man/update.Rd 0000644 0001762 0000144 00000004564 14574356445 013602 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/update.R
\name{update}
\alias{update}
\title{Update packages}
\usage{
update(
packages = NULL,
...,
exclude = NULL,
library = NULL,
rebuild = FALSE,
check = FALSE,
prompt = interactive(),
lock = FALSE,
project = NULL
)
}
\arguments{
\item{packages}{A character vector of \R packages to update. When \code{NULL}
(the default), all packages (apart from any listed in the \code{ignored.packages}
project setting) will be updated.}
\item{...}{Unused arguments, reserved for future expansion. If any arguments
are matched to \code{...}, renv will signal an error.}
\item{exclude}{A set of packages to explicitly exclude from updating.
Use \verb{renv::update(exclude = <...>)} to update all packages except for
a specific set of excluded packages.}
\item{library}{The \R library to be used. When \code{NULL}, the active project
library will be used instead.}
\item{rebuild}{Force packages to be rebuilt, thereby bypassing any installed
versions of the package available in the cache? This can either be a
boolean (indicating that all installed packages should be rebuilt), or a
vector of package names indicating which packages should be rebuilt.}
\item{check}{Boolean; check for package updates without actually
installing available updates? This is useful when you'd like to determine
what updates are available, without actually installing those updates.}
\item{prompt}{Boolean; prompt the user before taking any action? For backwards
compatibility, \code{confirm} is accepted as an alias for \code{prompt}.}
\item{lock}{Boolean; update the \code{renv.lock} lockfile after the successful
installation of the requested packages?}
\item{project}{The project directory. If \code{NULL}, then the active project will
be used. If no project is currently active, then the current working
directory is used instead.}
}
\value{
A named list of package records which were installed by renv.
}
\description{
Update packages which are currently out-of-date. Currently supports CRAN,
Bioconductor, other CRAN-like repositories, GitHub, GitLab, Git, and
BitBucket.
Updates will only be checked from the same source -- for example,
if a package was installed from GitHub, but a newer version is
available on CRAN, that updated version will not be seen.
}
\examples{
\dontrun{
# update the 'dplyr' package
renv::update("dplyr")
}
}
renv/man/rehash.Rd 0000644 0001762 0000144 00000001742 14441721610 013544 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/rehash.R
\name{rehash}
\alias{rehash}
\title{Re-hash packages in the renv cache}
\usage{
rehash(prompt = interactive(), ...)
}
\arguments{
\item{prompt}{Boolean; prompt the user before taking any action? For backwards
compatibility, \code{confirm} is accepted as an alias for \code{prompt}.}
\item{...}{Unused arguments, reserved for future expansion. If any arguments
are matched to \code{...}, renv will signal an error.}
}
\description{
Re-hash packages in the renv cache, ensuring that any previously-cached
packages are copied to a new cache location appropriate for this version of
renv. This can be useful if the cache scheme has changed in a new version
of renv, but you'd like to preserve your previously-cached packages.
}
\details{
Any packages which are re-hashed will retain links to the location of the
newly-hashed package, ensuring that prior installations of renv can still
function as expected.
}
renv/man/vendor.Rd 0000644 0001762 0000144 00000002347 14464550375 013606 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/vendor.R
\name{vendor}
\alias{vendor}
\title{Vendor renv in an R package}
\usage{
vendor(version = "main", project = getwd())
}
\arguments{
\item{version}{The version of renv to vendor. \code{renv} sources will be pulled
from GitHub, and so \code{version} should refer to either a commit hash or a
branch name.}
\item{project}{The project in which renv should be vendored.}
}
\description{
Calling \code{renv:::vendor()} will:
\itemize{
\item Compile a vendored copy of renv to \code{inst/vendor/renv.R},
\item Generate an renv auto-loader at \code{R/renv.R}.
}
Using this, projects can take a dependency on renv, and use renv
internals, in a CRAN-compliant way. After vendoring renv, you can
use renv APIs in your package via the embedded renv environment;
for example, you could call the \code{\link[=dependencies]{dependencies()}} function with:
\if{html}{\out{
}}
Be aware that renv internals might change in future releases, so if you
need to rely on renv internal functions, we strongly recommend testing
your usages of these functions to avoid potential breakage.
}
\keyword{internal}
renv/man/load.Rd 0000644 0001762 0000144 00000005013 14574517042 013215 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/load.R
\name{load}
\alias{load}
\title{Load a project}
\usage{
load(project = NULL, quiet = FALSE, profile = NULL, ...)
}
\arguments{
\item{project}{The project directory. If \code{NULL}, then the active project will
be used. If no project is currently active, then the current working
directory is used instead.}
\item{quiet}{Boolean; be quiet during load?}
\item{profile}{The profile to be activated. See
\code{vignette("profiles", package = "renv")} for more information.}
\item{...}{Unused arguments, reserved for future expansion. If any arguments
are matched to \code{...}, renv will signal an error.}
}
\value{
The project directory, invisibly. Note that this function is normally
called for its side effects.
}
\description{
\code{renv::load()} sets the library paths to use a project-local library,
sets up the system library \link{sandbox}, if needed, and creates shims
for \code{install.packages()}, \code{update.packages()}, and \code{remove.packages()}.
You should not generally need to call \code{renv::load()} yourself, as it's
called automatically by the project auto-loader created by \code{\link[=init]{init()}}/
\code{\link[=activate]{activate()}}. However, if needed, you can use \code{renv::load("")}
to explicitly load an renv project located at a particular path.
}
\section{Shims}{
To help you take advantage of the package cache, renv places a couple of
shims on the search path:
\itemize{
\item \code{install.packages()} instead calls \code{renv::install()}.
\item \code{remove.packages()} instead calls \code{renv::remove()}.
\item \code{update.packages()} instead calls \code{renv::update()}.
}
This allows you to keep using your existing muscle memory for installing,
updating, and remove packages, while taking advantage of renv features
like the package cache.
If you'd like to bypass these shims within an \R session, you can explicitly
call the version of these functions from the utils package, e.g. with
\verb{utils::install.packages(<...>)}.
If you'd prefer not to use the renv shims at all, they can be disabled by
setting the R option \code{options(renv.config.shims.enabled = FALSE)} or by
setting the environment variable \code{RENV_CONFIG_SHIMS_ENABLED = FALSE}. See
\code{?config} for more details.
}
\examples{
\dontrun{
# load a project -- note that this is normally done automatically
# by the project's auto-loader, but calling this explicitly to
# load a particular project may be useful in some circumstances
renv::load()
}
}
renv/man/hydrate.Rd 0000644 0001762 0000144 00000005642 14547051446 013747 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/hydrate.R
\name{hydrate}
\alias{hydrate}
\title{Copy packages from user libraries to a project library}
\usage{
hydrate(
packages = NULL,
...,
library = NULL,
repos = getOption("repos"),
update = FALSE,
sources = NULL,
prompt = interactive(),
report = TRUE,
project = NULL
)
}
\arguments{
\item{packages}{The set of \R packages to install. When \code{NULL}, the
packages found by \code{\link[=dependencies]{dependencies()}} are used.}
\item{...}{Unused arguments, reserved for future expansion. If any arguments
are matched to \code{...}, renv will signal an error.}
\item{library}{The \R library to be hydrated. When \code{NULL}, the active
library as reported by \code{.libPaths()} is used.}
\item{repos}{The \R repositories to be used. If the project depends on any
\R packages which cannot be found within the user library paths, then
those packages will be installed from these repositories instead.}
\item{update}{Boolean; should \code{hydrate()} attempt to update already-installed
packages if the requested package is already installed in the project
library? Set this to \code{"all"} if you'd like \emph{all} packages to be refreshed
from the source library if possible.}
\item{sources}{A vector of library paths where renv should look for packages.
When \code{NULL} (the default), \code{hydrate()} will look in the system libraries
(the user library, the site library and the default library) then the
renv cache.
If a package is not found in any of these locations, \code{hydrate()}
will try to install it from the active R repositories.}
\item{prompt}{Boolean; prompt the user before taking any action? Ignored
when \code{report = FALSE}.}
\item{report}{Boolean; display a report of what packages will be installed
by \code{renv::hydrate()}?}
\item{project}{The project directory. If \code{NULL}, then the active project will
be used. If no project is currently active, then the current working
directory is used instead.}
}
\value{
A named \R list, giving the packages that were used for hydration
as well as the set of packages which were not found.
}
\description{
\code{hydrate()} installs missing packages from a user library into the project
library. \code{hydrate()} is called automatically by \code{\link[=init]{init()}}, and it is rare
that you should need it otherwise, as it can easily get your project into
an inconsistent state.
It may very occasionally be useful to call \code{hydrate(update = "all")} if you
want to update project packages to match those installed in your global
library (as opposed to using \code{\link[=update]{update()}} which will get the latest versions
from CRAN). In this case, you should verify that your code continues to work,
then call \code{\link[=snapshot]{snapshot()}} to record updated package versions in the lockfile.
}
\examples{
\dontrun{
# hydrate the active library
renv::hydrate()
}
}
\keyword{internal}
renv/man/graph.Rd 0000644 0001762 0000144 00000003443 14502607107 013375 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/graph.R
\name{graph}
\alias{graph}
\title{Generate a Package Dependency Graph}
\usage{
graph(
root = NULL,
leaf = NULL,
...,
suggests = FALSE,
enhances = FALSE,
resolver = NULL,
renderer = c("DiagrammeR", "visNetwork"),
attributes = list(),
project = NULL
)
}
\arguments{
\item{root}{The top-most package dependencies of interest in the dependency graph.}
\item{leaf}{The bottom-most package dependencies of interest in the dependency graph.}
\item{...}{Unused arguments, reserved for future expansion. If any arguments
are matched to \code{...}, renv will signal an error.}
\item{suggests}{Should suggested packages be included within
the dependency graph?}
\item{enhances}{Should enhanced packages be included within
the dependency graph?}
\item{resolver}{An \R function accepting a package name, and returning the
contents of its \code{DESCRIPTION} file (as an \R \code{data.frame} or \code{list}).
When \code{NULL} (the default), an internal resolver is used.}
\item{renderer}{Which package should be used to render the resulting graph?}
\item{attributes}{An \R list of graphViz attributes, mapping node names to
attribute key-value pairs. For example, to ask graphViz to prefer orienting
the graph from left to right, you can use \code{list(graph = c(rankdir = "LR"))}.}
\item{project}{The project directory. If \code{NULL}, then the active project will
be used. If no project is currently active, then the current working
directory is used instead.}
}
\description{
Generate a package dependency graph.
}
\examples{
\dontrun{
# graph the relationship between devtools and rlang
graph(root = "devtools", leaf = "rlang")
# figure out why a project depends on 'askpass'
graph(leaf = "askpass")
}
}
\keyword{internal}
renv/man/config.Rd 0000644 0001762 0000144 00000041507 14547051446 013554 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/config-defaults.R, R/config.R
\docType{data}
\name{config}
\alias{config}
\title{User-level settings}
\usage{
config
}
\description{
Configure different behaviors of renv.
}
\details{
For a given configuration option:
\enumerate{
\item If an \R option of the form \verb{renv.config.} is available,
then that option's value will be used;
\item If an environment variable of the form \verb{RENV_CONFIG_} is available,
then that option's value will be used;
\item Otherwise, the default for that particular configuration value is used.
}
Any periods (\code{.})s in the option name are transformed into underscores (\verb{_})
in the environment variable name, and vice versa. For example, the
configuration option \code{auto.snapshot} could be configured as:
\itemize{
\item \verb{options(renv.config.auto.snapshot = <...>)}
\item \verb{Sys.setenv(RENV_CONFIG_AUTO_SNAPSHOT = <...>)}
}
Note that if both the \R option and the environment variable are defined, the
\R option will be used instead. Environment variables can be more useful when
you want a particular configuration to be automatically inherited by child
processes; if that behavior is not desired, then the R option may be
preferred.
If you want to set and persist these options across multiple projects, it is
recommended that you set them in a a startup \code{.Renviron} file; e.g. in your
own \verb{~/.Renviron}, or in the R installation's \code{etc/Rprofile.site} file. See
\link{Startup} for more details.
Configuration options can also be set within the project \code{.Rprofile}, but
be aware the options should be set before \code{source("renv/activate.R")} is
called.
}
\section{Configuration}{
The following renv configuration options are available:
\subsection{renv.config.activate.prompt}{Automatically prompt the user to activate the current project, if it does not appear to already be activated? This is mainly useful to help ensure that calls to \code{renv::snapshot()} and \code{renv::restore()} use the project library. See \code{?renv::activate} for more details.
Defaults to \code{TRUE}.}
\subsection{renv.config.autoloader.enabled}{Enable the renv auto-loader? When \code{FALSE}, renv will not automatically load a project containing an renv autoloader within its \code{.Rprofile}. In addition, renv will not write out the project auto-loader in calls to \code{renv::init()}.
Defaults to \code{TRUE}.}
\subsection{renv.config.auto.snapshot}{Automatically snapshot changes to the project library when the project dependencies change?
Defaults to \code{FALSE}.}
\subsection{renv.config.bitbucket.host}{The default Bitbucket host to be used during package retrieval.
Defaults to \code{"api.bitbucket.org/2.0"}.}
\subsection{renv.config.copy.method}{The method to use when attempting to copy directories. See \strong{Copy Methods} for more information.
Defaults to \code{"auto"}.}
\subsection{renv.config.connect.timeout}{The amount of time to spend (in seconds) when attempting to download a file. Only applicable when the \code{curl} downloader is used.
Defaults to \code{20L}.}
\subsection{renv.config.connect.retry}{The number of times to attempt re-downloading a file, when transient download errors occur. Only applicable when the \code{curl} downloader is used.
Defaults to \code{3L}.}
\subsection{renv.config.cache.enabled}{Enable the global renv package cache? When active, renv will install packages into a global cache, and link or copy packages from the cache into your \R library as appropriate. This can greatly save on disk space and install time when \R packages are shared across multiple projects in the same environment.
Defaults to \code{TRUE}.}
\subsection{renv.config.cache.symlinks}{Symlink packages from the global renv package cache into your project library? When \code{TRUE}, renv will use symlinks (or, on Windows, junction points) to reference packages installed in the cache. Set this to \code{FALSE} if you'd prefer to copy packages from the cache into your project library. Enabled by default, except on Windows where this feature is only enabled if the project library and global package cache are on the same volume.
Defaults to \code{NULL}.}
\subsection{renv.config.dependency.errors}{Many renv APIs require the enumeration of your project's \R package dependencies. This option controls how errors that occur during this enumeration are handled. By default, errors are reported but are non-fatal. Set this to \code{"fatal"} to force errors to be fatal, and \code{"ignored"} to ignore errors altogether. See \code{\link[=dependencies]{dependencies()}} for more details.
Defaults to \code{"reported"}.}
\subsection{renv.config.dependencies.limit}{By default, renv reports if it discovers more than this many files when looking for dependencies, as that may indicate you are running \code{dependencies()} in the wrong place. Set to \code{Inf} to disable this warning.
Defaults to \code{1000L}.}
\subsection{renv.config.exported.functions}{When \code{library(renv)} is called, should its exports be placed on the search path? Set this to \code{FALSE} to avoid issues that can arise with, for example, \code{renv::load()} masking \code{base::load()}. In general, we recommend referencing renv functions from its namespace explicitly; e.g. prefer \code{renv::snapshot()} over \code{snapshot()}.
By default, all exported renv functions are attached and placed on the search path, for backwards compatibility with existing scripts using renv.
Defaults to \code{"*"}.}
\subsection{renv.config.external.libraries}{A character vector of external libraries, to be used in tandem with your projects. Be careful when using external libraries: it's possible that things can break within a project if the version(s) of packages used in your project library happen to be incompatible with packages in your external libraries; for example, if your project required \verb{xyz 1.0} but \verb{xyz 1.1} was present and loaded from an external library. Can also be an \R function that provides the paths to external libraries. Library paths will be expanded via \code{\link[=.expand_R_libs_env_var]{.expand_R_libs_env_var()}} as necessary.
Defaults to \code{NULL}.}
\subsection{renv.config.filebacked.cache}{Enable the renv file-backed cache? When enabled, renv will cache the contents of files that are read (e.g. DESCRIPTION files) in memory, thereby avoiding re-reading the file contents from the filesystem if the file has not changed. renv uses the file \code{mtime} to determine if the file has changed; consider disabling this if \code{mtime} is unreliable on your system.
Defaults to \code{TRUE}.}
\subsection{renv.config.github.host}{The default GitHub host to be used during package retrieval.
Defaults to \code{"api.github.com"}.}
\subsection{renv.config.gitlab.host}{The default GitLab host to be used during package retrieval.
Defaults to \code{"gitlab.com"}.}
\subsection{renv.config.hydrate.libpaths}{A character vector of library paths, to be used by \code{\link[=hydrate]{hydrate()}} when attempting to hydrate projects. When empty, the default set of library paths (as documented in \code{?renv::hydrate}) are used instead. See \code{\link[=hydrate]{hydrate()}} for more details.
Defaults to \code{NULL}.}
\subsection{renv.config.install.build}{Should downloaded package archives be built (via \verb{R CMD build}) before installation? When TRUE, package vignettes will also be built as part of package installation. Because building packages before installation may require packages within 'Suggests' to be available, this option is not enabled by default.
Defaults to \code{FALSE}.}
\subsection{renv.config.install.remotes}{Should renv read a package's \verb{Remotes:} field when determining how package dependencies should be installed?
Defaults to \code{TRUE}.}
\subsection{renv.config.install.shortcuts}{Allow for a set of 'shortcuts' when installing packages with renv? When enabled, if renv discovers that a package to be installed is already available within the user or site libraries, then it will install a local copy of that package.
Defaults to \code{TRUE}.}
\subsection{renv.config.install.staged}{DEPRECATED: Please use \code{renv.config.install.transactional} instead.
Defaults to \code{TRUE}.}
\subsection{renv.config.install.transactional}{Perform a transactional install of packages during install and restore? When enabled, renv will first install packages into a temporary library, and later copy or move those packages back into the project library only if all packages were successfully downloaded and installed. This can be useful if you'd like to avoid mutating your project library if installation of one or more packages fails.
Defaults to \code{TRUE}.}
\subsection{renv.config.install.verbose}{Be verbose when installing R packages from sources? When \code{TRUE}, renv will stream any output generated during package build + installation to the console.
Defaults to \code{FALSE}.}
\subsection{renv.config.locking.enabled}{Use interprocess locks when invoking methods which might mutate the project library? Enable this to allow multiple processes to use the same renv project, while minimizing risks relating to concurrent access to the project library. Disable this if you encounter locking issues. Locks are stored as files within the project at \code{renv/lock}; if you need to manually remove a stale lock you can do so via \code{unlink("renv/lock", recursive = TRUE)}.
Defaults to \code{FALSE}.}
\subsection{renv.config.mran.enabled}{DEPRECATED: MRAN is no longer maintained by Microsoft.
Defaults to \code{FALSE}.}
\subsection{renv.config.pak.enabled}{Use the \href{https://pak.r-lib.org/}{pak} package to install packages?
Defaults to \code{FALSE}.}
\subsection{renv.config.ppm.enabled}{Boolean; enable \href{https://packagemanager.posit.co/}{Posit Package Manager} integration in renv projects? When \code{TRUE}, renv will attempt to transform repository URLs used by PPM into binary URLs as appropriate for the current Linux platform. Set this to \code{FALSE} if you'd like to continue using source-only PPM URLs, or if you find that renv is improperly transforming your repository URLs. You can still set and use PPM repositories with this option disabled; it only controls whether renv tries to transform source repository URLs into binary URLs on your behalf.
Defaults to \code{TRUE}.}
\subsection{renv.config.ppm.default}{Boolean; should new projects use the \href{https://packagemanager.posit.co/}{Posit Public Package Manager} instance by default? When \code{TRUE} (the default), projects initialized with \code{renv::init()} will use the P3M instance if the \code{repos} R option has not already been set by some other means (for example, in a startup \code{.Rprofile}).
Defaults to \code{TRUE}.}
\subsection{renv.config.ppm.url}{The default PPM URL to be used for new renv projects. Defaults to the CRAN mirror maintained by Posit at \url{https://packagemanager.posit.co/}. This option can be changed if you'd like renv to use an alternate package manager instance.
Defaults to \code{"https://packagemanager.posit.co/cran/latest"}.}
\subsection{renv.config.repos.override}{Override the R package repositories used during \code{\link[=restore]{restore()}}? Primarily useful for deployment / continuous integration, where you might want to enforce the usage of some set of repositories over what is defined in \code{renv.lock} or otherwise set by the R session.
Defaults to \code{NULL}.}
\subsection{renv.config.rspm.enabled}{DEPRECATED: Please use \code{renv.config.ppm.enabled} instead.
Defaults to \code{TRUE}.}
\subsection{renv.config.sandbox.enabled}{Enable sandboxing for renv projects? When active, renv will attempt to sandbox the system library, preventing non-system packages installed in the system library from becoming available in renv projects. (That is, only packages with priority \code{"base"} or \code{"recommended"}, as reported by \code{installed.packages()}, are made available.)
Sandboxing is done by linking or copying system packages into a separate library path, and then instructing R to use that library path as the system library path. In some environments, this action can take a large amount of time -- in such a case, you may want to disable the renv sandbox.
Defaults to \code{TRUE}.}
\subsection{renv.config.shims.enabled}{Should renv shims be installed on package load? When enabled, renv will install its own shims over the functions \code{install.packages()}, \code{update.packages()} and \code{remove.packages()}, delegating these functions to \code{\link[=install]{install()}}, \code{\link[=update]{update()}} and \code{\link[=remove]{remove()}} as appropriate.
Defaults to \code{TRUE}.}
\subsection{renv.config.snapshot.inference}{For packages which were installed from local sources, should renv try to infer the package's remote from its DESCRIPTION file? When \code{TRUE}, renv will check and prompt you to update the package's DESCRIPTION file if the remote source can be ascertained. Currently, this is only implemented for packages hosted on GitHub. Note that this check is only performed in interactive R sessions.
Defaults to \code{TRUE}.}
\subsection{renv.config.snapshot.validate}{Validate \R package dependencies when calling snapshot? When \code{TRUE}, renv will attempt to diagnose potential issues in the project library before creating \code{renv.lock} -- for example, if a package installed in the project library depends on a package which is not currently installed.
Defaults to \code{TRUE}.}
\subsection{renv.config.startup.quiet}{Be quiet during startup? When set, renv will not display the typical \verb{Project loaded. [renv ]} banner on startup.
Defaults to \code{NULL}.}
\subsection{renv.config.synchronized.check}{Check that the project library is synchronized with the lockfile on load?
Defaults to \code{TRUE}.}
\subsection{renv.config.updates.check}{Check for package updates when the session is initialized? This can be useful if you'd like to ensure that your project lockfile remains up-to-date with packages as they are released on CRAN.
Defaults to \code{FALSE}.}
\subsection{renv.config.updates.parallel}{Check for package updates in parallel? This can be useful when a large number of packages installed from non-CRAN remotes are installed, as these packages can then be checked for updates in parallel.
Defaults to \code{2L}.}
\subsection{renv.config.user.environ}{Load the user R environ (typically located at \verb{~/.Renviron}) when renv is loaded?
Defaults to \code{TRUE}.}
\subsection{renv.config.user.library}{Include the system library on the library paths for your projects? Note that this risks breaking project encapsulation and is not recommended for projects which you intend to share or collaborate on with other users. See also the caveats for the \code{renv.config.external.libraries} option.
Defaults to \code{FALSE}.}
\subsection{renv.config.user.profile}{Load the user R profile (typically located at \verb{~/.Rprofile}) when renv is loaded? This is disabled by default, as running arbitrary code from the the user \verb{~/.Rprofile} could risk breaking project encapsulation. If your goal is to set environment variables that are visible within all renv projects, then placing those in \verb{~/.Renviron} is often a better choice. Defaults to \code{FALSE}.}
}
\section{Copy methods}{
If you find that renv is unable to copy some directories in your
environment, you may want to try setting the \code{copy.method} option. By
default, renv will try to choose a system tool that is likely to succeed in
copying files on your system -- \code{robocopy} on Windows, and \code{cp} on Unix.
renv will also instruct these tools to preserve timestamps and attributes
when copying files. However, you can select a different method as
appropriate.
The following methods are supported:
\tabular{ll}{
\code{auto} \tab Use \code{robocopy} on Windows, and \code{cp} on Unix-alikes. \cr
\code{R} \tab Use \R's built-in \code{file.copy()} function. \cr
\code{cp} \tab Use \code{cp} to copy files. \cr
\code{robocopy} \tab Use \code{robocopy} to copy files. (Only available on Windows.) \cr
\code{rsync} \tab Use \code{rsync} to copy files. \cr
}
You can also provide a custom copy method if required; e.g.
\if{html}{\out{
}}\preformatted{options(renv.config.copy.method = function(src, dst) \{
# copy a file from 'src' to 'dst'
\})
}\if{html}{\out{
}}
Note that renv will always first attempt to copy a directory first to a
temporary path within the target folder, and then rename that temporary path
to the final target destination. This helps avoid issues where a failed
attempt to copy a directory could leave a half-copied directory behind
in the final location.
}
\section{Project-local settings}{
For settings that should persist alongside a particular project, the
various settings available in \link{settings} can be used.
}
\examples{
# disable automatic snapshots
options(renv.config.auto.snapshot = FALSE)
# disable with environment variable
Sys.setenv(RENV_CONFIG_AUTO_SNAPSHOT = FALSE)
}
\keyword{datasets}
renv/man/history.Rd 0000644 0001762 0000144 00000002370 14441721610 013771 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/history.R
\name{history}
\alias{history}
\alias{revert}
\title{View and revert to a historical lockfile}
\usage{
history(project = NULL)
revert(commit = "HEAD", ..., project = NULL)
}
\arguments{
\item{project}{The project directory. If \code{NULL}, then the active project will
be used. If no project is currently active, then the current working
directory is used instead.}
\item{commit}{The commit associated with a prior version of the lockfile.}
\item{...}{Optional arguments; currently unused.}
}
\value{
\code{history()} returns a \code{data.frame} summarizing the commits in which
\code{renv.lock} has been changed. \code{revert()} is usually called for its
side-effect but also invisibly returns the \code{commit} used.
}
\description{
\code{history()} uses your version control system to show prior versions of the
lockfile and \code{revert()} allows you to restore one of them.
These functions are currently only implemented for projects that use git.
}
\examples{
\dontrun{
# get history of previous versions of renv.lock in VCS
db <- renv::history()
# choose an older commit
commit <- db$commit[5]
# revert to that version of the lockfile
renv::revert(commit = commit)
}
}
renv/man/lockfiles.Rd 0000644 0001762 0000144 00000013656 14475733536 014275 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/lockfiles.R
\name{lockfiles}
\alias{lockfiles}
\alias{lockfile_create}
\alias{lockfile_read}
\alias{lockfile_write}
\alias{lockfile_modify}
\title{Lockfiles}
\usage{
lockfile_create(
type = settings$snapshot.type(project = project),
libpaths = .libPaths(),
packages = NULL,
exclude = NULL,
prompt = interactive(),
force = FALSE,
...,
project = NULL
)
lockfile_read(file = NULL, ..., project = NULL)
lockfile_write(lockfile, file = NULL, ..., project = NULL)
lockfile_modify(
lockfile = NULL,
...,
remotes = NULL,
repos = NULL,
project = NULL
)
}
\arguments{
\item{type}{The type of snapshot to perform:
\itemize{
\item \code{"implict"}, (the default), uses all packages captured by \code{\link[=dependencies]{dependencies()}}.
\item \code{"explicit"} uses packages recorded in \code{DESCRIPTION}.
\item \code{"all"} uses all packages in the project library.
\item \code{"custom"} uses a custom filter.
}
See \strong{Snapshot type} below for more details.}
\item{libpaths}{The library paths to be used when generating the lockfile.}
\item{packages}{A vector of packages to be included in the lockfile. When
\code{NULL} (the default), all packages relevant for the type of snapshot being
performed will be included. When set, the \code{type} argument is ignored.
Recursive dependencies of the specified packages will be added to the
lockfile as well.}
\item{exclude}{A vector of packages to be explicitly excluded from the lockfile.
Note that transitive package dependencies will always be included, to avoid
potentially creating an incomplete / non-functional lockfile.}
\item{prompt}{Boolean; prompt the user before taking any action? For backwards
compatibility, \code{confirm} is accepted as an alias for \code{prompt}.}
\item{force}{Boolean; force generation of a lockfile even when pre-flight
validation checks have failed?}
\item{...}{Unused arguments, reserved for future expansion. If any arguments
are matched to \code{...}, renv will signal an error.}
\item{project}{The project directory. If \code{NULL}, then the active project will
be used. If no project is currently active, then the current working
directory is used instead.}
\item{file}{A file path, or \R connection.}
\item{lockfile}{An \code{renv} lockfile; typically created by either
\code{lockfile_create()} or \code{lockfile_read()}.}
\item{remotes}{An \R vector of remote specifications.}
\item{repos}{A named vector, mapping \R repository names to their URLs.}
}
\description{
A \strong{lockfile} records the state of a project at some point in time.
}
\details{
A lockfile captures the state of a project's library at some point in time.
In particular, the package names, their versions, and their sources (when
known) are recorded in the lockfile.
Projects can be restored from a lockfile using the \code{\link[=restore]{restore()}} function. This
implies reinstalling packages into the project's private library, as encoded
within the lockfile.
While lockfiles are normally generated and used with \code{\link[=snapshot]{snapshot()}} /
\code{\link[=restore]{restore()}}, they can also be edited by hand if so desired. Lockfiles are
written as \code{.json}, to allow for easy consumption by other tools.
An example lockfile follows:
\if{html}{\out{
}}
The sections used within a lockfile are described next.
\subsection{renv}{
Information about the version of renv used to manage this project.
\tabular{ll}{
\strong{Version} \tab The version of the renv package used with this project. \cr
}
}
\subsection{R}{
Properties related to the version of \R associated with this project.
\tabular{ll}{
\strong{Version} \tab The version of \R used. \cr
\strong{Repositories} \tab The \R repositories used in this project. \cr
}
}
\subsection{Packages}{
\R package records, capturing the packages used or required by a project
at the time when the lockfile was generated.
\tabular{ll}{
\strong{Package} \tab The package name. \cr
\strong{Version} \tab The package version. \cr
\strong{Source} \tab The location from which this package was retrieved. \cr
\strong{Repository} \tab The name of the repository (if any) from which this package was retrieved. \cr
\strong{Hash} \tab (Optional) A unique hash for this package, used for package caching. \cr
}
Additional remote fields, further describing how the package can be
retrieved from its corresponding source, will also be included as
appropriate (e.g. for packages installed from GitHub).
}
\subsection{Python}{
Metadata related to the version of Python used with this project (if any).
\tabular{ll}{
\strong{Version} \tab The version of Python being used. \cr
\strong{Type} \tab The type of Python environment being used ("virtualenv", "conda", "system") \cr
\strong{Name} \tab The (optional) name of the environment being used.
}
Note that the \code{Name} field may be empty. In that case, a project-local Python
environment will be used instead (when not directly using a system copy of Python).
}
}
\section{Caveats}{
These functions are primarily intended for expert users -- in most cases,
\code{\link[=snapshot]{snapshot()}} and \code{\link[=restore]{restore()}} are the primariy tools you will need when
creating and using lockfiles.
}
\seealso{
Other reproducibility:
\code{\link{restore}()},
\code{\link{snapshot}()}
}
\concept{reproducibility}
renv/man/isolate.Rd 0000644 0001762 0000144 00000002636 14441721610 013735 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/isolate.R
\name{isolate}
\alias{isolate}
\title{Isolate a project}
\usage{
isolate(project = NULL)
}
\arguments{
\item{project}{The project directory. If \code{NULL}, then the active project will
be used. If no project is currently active, then the current working
directory is used instead.}
}
\value{
The project directory, invisibly. Note that this function is normally
called for its side effects.
}
\description{
Copy packages from the renv cache directly into the project library, so
that the project can continue to function independently of the renv cache.
}
\details{
After calling \code{isolate()}, renv will still be able to use the cache on
future \code{\link[=install]{install()}}s and \code{\link[=restore]{restore()}}s. If you'd prefer that renv copy
packages from the cache, rather than use symlinks, you can set the renv
configuration option:
\if{html}{\out{
}}
to force renv to copy packages from the cache, as opposed to symlinking
them. If you'd like to disable the cache altogether for a project, you can
use:
\if{html}{\out{
}}
to explicitly disable the cache for the project.
}
\examples{
\dontrun{
# isolate a project
renv::isolate()
}
}
renv/man/record.Rd 0000644 0001762 0000144 00000003343 14464550375 013564 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/record.R
\name{record}
\alias{record}
\title{Update package records in a lockfile}
\usage{
record(records, lockfile = NULL, project = NULL)
}
\arguments{
\item{records}{A list of named records, mapping package names to a definition
of their source. See \strong{Records} for more details.}
\item{lockfile}{Path to a lockfile. When \code{NULL} (the default), the
\code{renv.lock} located in the root of the current project will be used.}
\item{project}{The project directory. If \code{NULL}, then the active project will
be used. If no project is currently active, then the current working
directory is used instead.}
}
\description{
Use \code{record()} to record a new entry within an existing renv lockfile.
}
\details{
This function can be useful when you need to change one or more of the
package records within an renv lockfile -- for example, because a recorded
package cannot be restored in a particular environment, and you know of a
suitable alternative.
}
\section{Records}{
Records can be provided either using the \strong{remotes} short-hand syntax,
or by using an \R list of entries to record within the lockfile. See
\code{?lockfiles} for more information on the structure of a package record.
}
\examples{
\dontrun{
# use digest 0.6.22 from package repositories -- different ways
# of specifying the remote. use whichever is most natural
renv::record("digest@0.6.22")
renv::record(list(digest = "0.6.22"))
renv::record(list(digest = "digest@0.6.22"))
# alternatively, provide a full record as a list
digest_record <- list(
Package = "digest",
Version = "0.6.22",
Source = "Repository",
Repository = "CRAN"
)
renv::record(list(digest = digest_record))
}
}
renv/man/dependencies.Rd 0000644 0001762 0000144 00000017132 14464550375 014735 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/dependencies.R
\name{dependencies}
\alias{dependencies}
\title{Find R package dependencies in a project}
\usage{
dependencies(
path = getwd(),
root = NULL,
...,
quiet = NULL,
progress = TRUE,
errors = c("reported", "fatal", "ignored"),
dev = FALSE
)
}
\arguments{
\item{path}{The path to a \code{.R}, \code{.Rmd}, \code{.qmd}, \code{DESCRIPTION}, a directory
containing such files, or an R function. The default uses all files
found within the current working directory and its children.}
\item{root}{The root directory to be used for dependency discovery.
Defaults to the active project directory. You may need to set this
explicitly to ensure that your project's \code{.renvignore}s (if any) are
properly handled.}
\item{...}{Unused arguments, reserved for future expansion. If any arguments
are matched to \code{...}, renv will signal an error.}
\item{quiet}{Boolean; be quiet while checking for dependencies?
Setting \code{quiet = TRUE} is equivalent to setting \code{progress = FALSE}
and \code{errors = "ignored"}, and overrides those options when not \code{NULL}.}
\item{progress}{Boolean; report progress output while enumerating
dependencies?}
\item{errors}{How should errors that occur during dependency enumeration be
handled?
\itemize{
\item \code{"reported"} (the default): errors are reported to the user, but
otherwise ignored.
\item \code{"fatal"}: errors are fatal and stop execution.
\item \code{"ignored"}: errors are ignored and not reported to the user.
}}
\item{dev}{Boolean; include development dependencies? These packages are
typically required when developing the project, but not when running it
(i.e. you want them installed when humans are working on the project but
not when computers are deploying it).
Development dependencies include packages listed in the \code{Suggests} field
of a \code{DESCRIPTION} found in the project root, and roxygen2 or devtools if
their use is implied by other project metadata. They also include packages
used in \verb{~/.Rprofile} if \code{config$user.profile()} is \code{TRUE}.}
}
\value{
An \R \code{data.frame} of discovered dependencies, mapping inferred
package names to the files in which they were discovered. Note that the
\code{Package} field might name a package remote, rather than just a plain
package name.
}
\description{
\code{dependencies()} will crawl files within your project, looking for \R files
and the packages used within those \R files. This is done primarily by
parsing the code and looking for calls of the form \code{library(package)},
\code{require(package)}, \code{requireNamespace("package")}, and \code{package::method()}.
renv also supports package loading with
\href{https://cran.r-project.org/package=box}{box} (\code{box::use(...)}) and
\href{https://cran.r-project.org/package=pacman}{pacman} (\code{pacman::p_load(...)})
.
For \R package projects, dependencies expressed in the \code{DESCRIPTION} file
will also be discovered.
Note that the rmarkdown package is required in order to crawl dependencies
in R Markdown files.
}
\section{Missing dependencies}{
\code{dependencies()} uses static analysis to determine which packages are used
by your project. This means that it inspects, but doesn't run, your
source. Static analysis generally works well, but is not 100\% reliable in
detecting the packages required by your project. For example, renv is
unable to detect this kind of usage:
\if{html}{\out{
}}
It also can't generally tell if one of the packages you use, uses one of
its suggested packages. For example, \code{tidyr::separate_wider_delim()}
uses the stringr package which is only suggested, not required by tidyr.
If you find that renv's dependency discovery misses one or more packages
that you actually use in your project, one escape hatch is to include a file
called \verb{_dependencies.R} that includes straightforward library calls:
\if{html}{\out{
}}
}
\section{Explicit dependencies}{
Alternatively, you can suppress dependency discover and instead rely
on an explicit set of packages recorded by you in a project \code{DESCRIPTION} file.
Call \code{renv::settings$snapshot.type("explicit")} to enable "explicit" mode,
then enumerate your dependencies in a project \code{DESCRIPTION} file.
In that case, your \code{DESCRIPTION} might look something like this:
\if{html}{\out{
}}
}
\section{Ignoring files}{
By default, renv will read your project's \code{.gitignore}s (if present) to
determine whether certain files or folders should be included when traversing
directories. If preferred, you can also create a \code{.renvignore} file (with
entries of the same format as a standard \code{.gitignore} file) to tell renv
which files to ignore within a directory. If both \code{.renvignore} and
\code{.gitignore} exist within a folder, the \code{.renvignore} will be used in lieu of
the \code{.gitignore}.
See \url{https://git-scm.com/docs/gitignore} for documentation on the
\code{.gitignore} format. Some simple examples here:
\if{html}{\out{
}}\preformatted{# ignore all R Markdown files
*.Rmd
# ignore all data folders
data/
# ignore only data folders from the root of the project
/data/
}\if{html}{\out{
}}
Using ignore files is important if your project contains a large number
of files; for example, if you have a \verb{data/} directory containing many
text files.
}
\section{Errors}{
renv's attempts to enumerate package dependencies in your project can fail
-- most commonly, because of failures when attempting to parse your \R code.
You can use the \code{errors} argument to suppress these problems, but a
more robust solution is tell renv not to look at the problematic code.
As well as using \code{.renvignore}, as described above, you can also suppress errors
discovered within individual \code{.Rmd} chunks by including \code{renv.ignore=TRUE}
in the chunk header. For example:
\if{html}{\out{
}}\preformatted{```\{r chunk-label, renv.ignore=TRUE\}
# code in this chunk will be ignored by renv
```
}\if{html}{\out{
}}
Similarly, if you'd like renv to parse a chunk that is otherwise ignored
(e.g. because it has \code{eval=FALSE} as a chunk header), you can set:
\if{html}{\out{
}}\preformatted{```\{r chunk-label, eval=FALSE, renv.ignore=FALSE\}
# code in this chunk will _not_ be ignored
```
}\if{html}{\out{
}}
}
\section{Development dependencies}{
renv has some support for distinguishing between development and run-time
dependencies. For example, your Shiny app might rely on
\href{https://ggplot2.tidyverse.org}{ggplot2} (a run-time dependency) but while
you use \href{https://usethis.r-lib.org}{usethis} during development, your app
doesn't need it to run (i.e. it's only a development dependency).
You can record development dependencies by listing them in the \code{Suggests}
field of your project's \code{DESCRIPTION} file. Development dependencies will be installed by
\code{\link[=install]{install()}} (when called without arguments) but will not be tracked in
the project snapshot. If you need greater control, you can also try project
profiles as discussed in \code{vignette("profiles")}.
}
\examples{
\dontrun{
# find R package dependencies in the current directory
renv::dependencies()
}
}
renv/man/settings.Rd 0000644 0001762 0000144 00000013126 14573145613 014142 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/settings.R
\docType{data}
\name{settings}
\alias{settings}
\title{Project settings}
\usage{
settings
}
\value{
A named list of renv settings.
}
\description{
Define project-local settings that can be used to adjust the behavior of
renv with your particular project.
\itemize{
\item Get the current value of a setting with (e.g.) \code{settings$snapshot.type()}
\item Set current value of a setting with (e.g.)
\code{settings$snapshot.type("explicit")}.
}
Settings are automatically persisted across project sessions by writing to
\code{renv/settings.json}. You can also edit this file by hand, but you'll need
to restart the session for those changes to take effect.
\subsection{\code{bioconductor.version}}{
The Bioconductor version to be used with this project. Use this if you'd
like to lock the version of Bioconductor used on a per-project basis.
When unset, renv will try to infer the appropriate Bioconductor release
using the BiocVersion package if installed; if not, renv uses
\code{BiocManager::version()} to infer the appropriate Bioconductor version.
}
\subsection{\code{external.libraries}}{
A vector of library paths, to be used in addition to the project's own
private library. This can be useful if you have a package available for use
in some system library, but for some reason renv is not able to install
that package (e.g. sources or binaries for that package are not publicly
available, or you have been unable to orchestrate the pre-requisites for
installing some packages from source on your machine).
}
\subsection{\code{ignored.packages}}{
A vector of packages, which should be ignored when attempting to snapshot
the project's private library. Note that if a package has already been
added to the lockfile, that entry in the lockfile will not be ignored.
}
\subsection{\code{package.dependency.fields}}{
When explicitly installing a package with \code{install()}, what fields
should be used to determine that packages dependencies? The default
uses \code{Imports}, \code{Depends} and \code{LinkingTo} fields, but you also want
to install \code{Suggests} dependencies for a package, you can set this to
\code{c("Imports", "Depends", "LinkingTo", "Suggests")}.
}
\subsection{\code{ppm.enabled}}{
Enable \href{https://packagemanager.posit.co/}{Posit Package Manager}
integration in this project? When \code{TRUE}, renv will attempt to transform
repository URLs used by PPM into binary URLs as appropriate for the
current Linux platform. Set this to \code{FALSE} if you'd like to continue using
source-only PPM URLs, or if you find that renv is improperly transforming
your repository URLs. You can still set and use PPM repositories with this
option disabled; it only controls whether renv tries to transform source
repository URLs into binary URLs on your behalf.
}
\subsection{\code{ppm.ignored.urls}}{
When \href{https://packagemanager.posit.co/}{Posit Package Manager} integration
is enabled, \code{renv} will attempt to transform source repository URLs into
binary repository URLs. This setting can be used if you'd like to avoid this
transformation with some subset of repository URLs.
}
\subsection{\code{r.version}}{
The version of \R to encode within the lockfile. This can be set as a
project-specific option if you'd like to allow multiple users to use
the same renv project with different versions of \R. renv will
still warn the user if the major + minor version of \R used in a project
does not match what is encoded in the lockfile.
}
\subsection{\code{snapshot.type}}{
The type of snapshot to perform by default. See \link{snapshot} for more
details.
}
\subsection{\code{use.cache}}{
Enable the renv package cache with this project. When active, renv will
install packages into a global cache, and link packages from the cache into
your renv projects as appropriate. This can greatly save on disk space
and install time when for \R packages which are used across multiple
projects in the same environment.
}
\subsection{\code{vcs.manage.ignores}}{
Should renv attempt to manage the version control system's ignore files
(e.g. \code{.gitignore}) within this project? Set this to \code{FALSE} if you'd
prefer to take control. Note that if this setting is enabled, you will
need to manually ensure internal data in the project's \verb{renv/} folder
is explicitly ignored.
}
\subsection{\code{vcs.ignore.cellar}}{
Set whether packages within a project-local package cellar are excluded
from version control. See \code{vignette("cellar", package = "renv")} for
more information.
}
\subsection{\code{vcs.ignore.library}}{
Set whether the renv project library is excluded from version control.
}
\subsection{\code{vcs.ignore.local}}{
Set whether renv project-specific local sources are excluded from version
control.
}
}
\section{Defaults}{
You can change the default values of these settings for newly-created renv
projects by setting \R options for \code{renv.settings} or \verb{renv.settings.}.
For example:
\if{html}{\out{
}}
If both of the \code{renv.settings} and \verb{renv.settings.} options are set
for a particular key, the option associated with \verb{renv.settings.} is
used instead. We recommend setting these in an appropriate startup profile,
e.g. \verb{~/.Rprofile} or similar.
}
\examples{
\dontrun{
# view currently-ignored packaged
renv::settings$ignored.packages()
# ignore a set of packages
renv::settings$ignored.packages("devtools", persist = FALSE)
}
}
\keyword{datasets}
renv/man/checkout.Rd 0000644 0001762 0000144 00000006141 14464550375 014112 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/checkout.R
\name{checkout}
\alias{checkout}
\title{Checkout a repository}
\usage{
checkout(
repos = NULL,
...,
packages = NULL,
date = NULL,
clean = FALSE,
actions = "restore",
project = NULL
)
}
\arguments{
\item{repos}{The \R package repositories to use.}
\item{...}{Unused arguments, reserved for future expansion. If any arguments
are matched to \code{...}, renv will signal an error.}
\item{packages}{The packages to be installed. When \code{NULL} (the default),
all packages currently used in the project will be installed, as
determined by \code{\link[=dependencies]{dependencies()}}. The recursive dependencies of these
packages will be included as well.}
\item{date}{The snapshot date to use. When set, the associated snapshot as
available from the Posit's public
\href{https://packagemanager.rstudio.com/}{Package Manager} instance will be
used. Ignored if \code{repos} is non-\code{NULL}.}
\item{clean}{Boolean; remove packages not recorded in the lockfile from
the target library? Use \code{clean = TRUE} if you'd like the library state
to exactly reflect the lockfile contents after \code{restore()}.}
\item{actions}{The action(s) to perform with the requested repositories.
This can either be "snapshot", in which \code{renv} will generate a lockfile
based on the latest versions of the packages available from \code{repos}, or
"restore" if you'd like to install those packages. You can use
\code{c("snapshot", "restore")} if you'd like to generate a lockfile and
install those packages in the same step.}
\item{project}{The project directory. If \code{NULL}, then the active project will
be used. If no project is currently active, then the current working
directory is used instead.}
}
\description{
\code{renv::checkout()} can be used to retrieve the latest-availabe packages from
a (set of) package repositories.
}
\details{
\code{renv::checkout()} is most useful with services like the Posit's
\href{https://packagemanager.rstudio.com/}{Package Manager}, as it
can be used to switch between different repository snapshots within an
renv project. In this way, you can upgrade (or downgrade) all of the
packages used in a particular renv project to the package versions
provided by a particular snapshot.
If your library contains packages installed from other remote sources (e.g.
GitHub), but a version of a package of the same name is provided by the
repositories being checked out, then please be aware that the package will be
replaced with the version provided by the requested repositories. This could
be a concern if your project uses \R packages from GitHub whose name matches
that of an existing CRAN package, but is otherwise unrelated to the package
on CRAN.
}
\examples{
\dontrun{
# check out packages from PPM using the date '2023-01-02'
renv::checkout(date = "2023-01-02")
# alternatively, supply the full repository path
renv::checkout(repos = "https://packagemanager.rstudio.com/cran/2023-01-02")
# only check out some subset of packages (and their recursive dependencies)
renv::checkout(packages = "dplyr", date = "2023-01-02")
}
}
renv/man/remove.Rd 0000644 0001762 0000144 00000002753 14441721610 013572 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/remove.R
\name{remove}
\alias{remove}
\title{Remove packages}
\usage{
remove(packages, ..., library = NULL, project = NULL)
}
\arguments{
\item{packages}{A character vector of \R packages to remove.}
\item{...}{Unused arguments, reserved for future expansion. If any arguments
are matched to \code{...}, renv will signal an error.}
\item{library}{The library from which packages should be removed. When
\code{NULL}, the active library (that is, the first entry reported in
\code{.libPaths()}) is used instead.}
\item{project}{The project directory. If \code{NULL}, then the active project will
be used. If no project is currently active, then the current working
directory is used instead.}
}
\value{
A vector of package records, describing the packages (if any) which
were successfully removed.
}
\description{
Remove (uninstall) \R packages.
}
\examples{
\dontrun{
# disable automatic snapshots
auto.snapshot <- getOption("renv.config.auto.snapshot")
options(renv.config.auto.snapshot = FALSE)
# initialize a new project (with an empty R library)
renv::init(bare = TRUE)
# install digest 0.6.19
renv::install("digest@0.6.19")
# save library state to lockfile
renv::snapshot()
# remove digest from library
renv::remove("digest")
# check library status
renv::status()
# restore lockfile, thereby reinstalling digest 0.6.19
renv::restore()
# restore automatic snapshots
options(renv.config.auto.snapshot = auto.snapshot)
}
}
renv/man/run.Rd 0000644 0001762 0000144 00000002263 14441721611 013076 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/run.R
\name{run}
\alias{run}
\title{Run a script}
\usage{
run(script, ..., job = NULL, name = NULL, project = NULL)
}
\arguments{
\item{script}{The path to an \R script.}
\item{...}{Unused arguments, reserved for future expansion. If any arguments
are matched to \code{...}, renv will signal an error.}
\item{job}{Run the requested script as an RStudio job? Requires a recent
version of both RStudio and the rstudioapi packages. When \code{NULL}, the
script will be run as a job if possible, and as a regular \R process
launched by \code{\link[=system2]{system2()}} if not.}
\item{name}{The name to associate with the job, for scripts run as a job.}
\item{project}{The path to the renv project. This project will be loaded
before the requested script is executed. When \code{NULL} (the default), renv
will automatically determine the project root for the associated script
if possible.}
}
\value{
The project directory, invisibly. Note that this function is normally
called for its side effects.
}
\description{
Run an \R script, in the context of a project using renv. The script will
be run within an \R sub-process.
}
renv/man/paths.Rd 0000644 0001762 0000144 00000015256 14570476327 013435 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/paths.R
\docType{data}
\name{paths}
\alias{paths}
\title{Path for storing global state}
\usage{
paths
}
\description{
By default, renv stores global state in the following OS-specific folders:
\tabular{ll}{
\strong{Platform} \tab \strong{Location} \cr
Linux \tab \verb{~/.cache/R/renv} \cr
macOS \tab \verb{~/Library/Caches/org.R-project.R/R/renv} \cr
Windows \tab \verb{\%LOCALAPPDATA\%/R/cache/R/renv} \cr
}
If desired, this path can be customized by setting the \code{RENV_PATHS_ROOT}
environment variable. This can be useful if you'd like, for example, multiple
users to be able to share a single global cache.
}
\section{Customising individual paths}{
The various state sub-directories can also be individually adjusted, if so
desired (e.g. you'd prefer to keep the cache of package installations on a
separate volume). The various environment variables that can be set are
enumerated below:
\tabular{ll}{
\strong{Environment Variable} \tab \strong{Description} \cr
\code{RENV_PATHS_ROOT} \tab The root path used for global state storage. \cr
\code{RENV_PATHS_LIBRARY} \tab The path to the project library. \cr
\code{RENV_PATHS_LIBRARY_ROOT} \tab The parent path for project libraries. \cr
\code{RENV_PATHS_LIBRARY_STAGING} \tab The parent path used for staged package installs. \cr
\code{RENV_PATHS_SANDBOX} \tab The path to the sandboxed \R system library. \cr
\code{RENV_PATHS_LOCKFILE} \tab The path to the \link{lockfile}. \cr
\code{RENV_PATHS_CELLAR} \tab The path to the cellar, containing local package binaries and sources. \cr
\code{RENV_PATHS_SOURCE} \tab The path containing downloaded package sources. \cr
\code{RENV_PATHS_BINARY} \tab The path containing downloaded package binaries. \cr
\code{RENV_PATHS_CACHE} \tab The path containing cached package installations. \cr
\code{RENV_PATHS_PREFIX} \tab An optional prefix to prepend to the constructed library / cache paths. \cr
\code{RENV_PATHS_RENV} \tab The path to the project's renv folder. For advanced users only. \cr
\code{RENV_PATHS_RTOOLS} \tab (Windows only) The path to \href{https://cran.r-project.org/bin/windows/Rtools/}{Rtools}. \cr
\code{RENV_PATHS_EXTSOFT} \tab (Windows only) The path containing external software needed for compilation of Windows source packages. \cr
}
(If you want these settings to persist in your project, it is recommended that
you add these to an appropriate \R startup file. For example, these could be
set in: a project-local \code{.Renviron}, the user-level \code{.Renviron}, or a
site-wide file at \code{file.path(R.home("etc"), "Renviron.site")}. See
\link{Startup} for more details).
Note that renv will append platform-specific and version-specific entries
to the set paths as appropriate. For example, if you have set:
\if{html}{\out{
}}
then the directory used for the cache will still depend on the renv cache
version (e.g. \code{v2}), the \R version (e.g. \code{3.5}) and the platform (e.g.
\code{x86_64-pc-linux-gnu}). For example:
\if{html}{\out{
}}
This ensures that you can set a single \code{RENV_PATHS_CACHE} environment variable
globally without worry that it may cause collisions or errors if multiple
versions of \R needed to interact with the same cache.
If reproducibility of a project is desired on a particular machine, it is
highly recommended that the renv cache of installed packages + binary
packages is backed up and persisted, so that packages can be easily restored
in the future -- installation of packages from source can often be arduous.
}
\section{Sharing state across operating systems}{
If you need to share the same cache with multiple different Linux operating
systems, you may want to set the \code{RENV_PATHS_PREFIX} environment variable
to help disambiguate the paths used on Linux. For example, setting
\code{RENV_PATHS_PREFIX = "ubuntu-bionic"} would instruct renv to construct a
cache path like:
\if{html}{\out{
}}
If this is required, it's strongly recommended that this environment
variable is set in your \R installation's \code{Renviron.site} file, typically
located at \code{file.path(R.home("etc"), "Renviron.site")}, so that it can be
active for any \R sessions launched on that machine.
Starting from \verb{renv 0.13.0}, you can also instruct renv to auto-generate
an OS-specific component to include as part of library and cache paths,
by setting the environment variable:
\if{html}{\out{
}}
The prefix will be constructed based on fields within the system's
\verb{/etc/os-release} file. Note that this is the default behavior with
\verb{renv 1.0.6} when using R 4.4.0 or later.
}
\section{Package cellar}{
If your project depends on one or \R packages that are not available in any
remote location, you can still provide a locally-available tarball for renv
to use during restore. By default, these packages should be made available in
the folder as specified by the \code{RENV_PATHS_CELLAR} environment variable. The
package sources should be placed in a file at one of these locations:
\itemize{
\item \verb{$\{RENV_PATHS_CELLAR\}/_.}
\item \verb{$\{RENV_PATHS_CELLAR\}//_.}
\item \verb{/renv/cellar/_.}
\item \verb{/renv/cellar//_.}
}
where \verb{.} is \code{.tar.gz} for source packages, or \code{.tgz} for binaries on
macOS and \code{.zip} for binaries on Windows. During \code{restore()}, renv will
search the cellar for a compatible package, and prefer installation with
that copy of the package if appropriate.
}
\section{Older versions}{
Older version of renv used a different default cache location.
Those cache locations are:
\tabular{ll}{
\strong{Platform} \tab \strong{Location} \cr
Linux \tab \verb{~/.local/share/renv} \cr
macOS \tab \verb{~/Library/Application Support/renv} \cr
Windows \tab \verb{\%LOCALAPPDATA\%/renv} \cr
}
If an renv root directory has already been created in one of the old
locations, that will still be used. This change was made to comply with the
CRAN policy requirements of \R packages.
}
\examples{
# get the path to the project library
path <- renv::paths$library()
}
\keyword{datasets}
renv/man/status.Rd 0000644 0001762 0000144 00000015320 14547051446 013624 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/status.R
\name{status}
\alias{status}
\title{Report inconsistencies between lockfile, library, and dependencies}
\usage{
status(
project = NULL,
...,
library = NULL,
lockfile = NULL,
sources = TRUE,
cache = FALSE,
dev = FALSE
)
}
\arguments{
\item{project}{The project directory. If \code{NULL}, then the active project will
be used. If no project is currently active, then the current working
directory is used instead.}
\item{...}{Unused arguments, reserved for future expansion. If any arguments
are matched to \code{...}, renv will signal an error.}
\item{library}{The library paths. By default, the library paths associated
with the requested project are used.}
\item{lockfile}{Path to a lockfile. When \code{NULL} (the default), the
\code{renv.lock} located in the root of the current project will be used.}
\item{sources}{Boolean; check that each of the recorded packages have a
known installation source? If a package has an unknown source, renv
may be unable to restore it.}
\item{cache}{Boolean; perform diagnostics on the global package cache?
When \code{TRUE}, renv will validate that the packages installed into the
cache are installed at the expected + proper locations, and validate the
hashes used for those storage locations.}
\item{dev}{Boolean; include development dependencies? These packages are
typically required when developing the project, but not when running it
(i.e. you want them installed when humans are working on the project but
not when computers are deploying it).
Development dependencies include packages listed in the \code{Suggests} field
of a \code{DESCRIPTION} found in the project root, and roxygen2 or devtools if
their use is implied by other project metadata. They also include packages
used in \verb{~/.Rprofile} if \code{config$user.profile()} is \code{TRUE}.}
}
\value{
This function is normally called for its side effects, but
it invisibly returns a list containing the following components:
\itemize{
\item \code{library}: packages in your library.
\item \code{lockfile}: packages in the lockfile.
\item \code{synchronized}: are the library and lockfile in sync?
}
}
\description{
\code{renv::status()} reports issues caused by inconsistencies across the project
lockfile, library, and \code{\link[=dependencies]{dependencies()}}. In general, you should strive to
ensure that \code{status()} reports no issues, as this maximizes your chances of
successfully \code{restore()}ing the project in the future or on another machine.
\code{renv::load()} will report if any issues are detected when starting an
renv project; we recommend resolving these issues before doing any
further work on your project.
See the headings below for specific advice on resolving any issues
revealed by \code{status()}.
}
\section{Missing packages}{
\code{status()} first checks that all packages used by the project are installed.
This must be done first because if any packages are missing we can't tell for
sure that a package isn't used; it might be a dependency that we don't know
about. Once you have resolve any installation issues, you'll need to run
\code{status()} again to reveal the next set of potential problems.
There are four possibilities for an uninstalled package:
\itemize{
\item If it's used and recorded, call \code{renv::restore()} to install the version
specified in the lockfile.
\item If it's used and not recorded, call \code{renv::install()} to install it
from CRAN or elsewhere.
\item If it's not used and recorded, call \code{renv::snapshot()} to
remove it from the lockfile.
\item If it's not used and not recorded, there's nothing to do. This the most
common state because you only use a small fraction of all available
packages in any one project.
}
If you have multiple packages in an inconsistent state, we recommend
\code{renv::restore()}, then \code{renv::install()}, then \code{renv::snapshot()}, but
that also suggests you should be running status more frequently.
}
\section{Lockfile vs \code{dependencies()}}{
Next we need to ensure that packages are recorded in the lockfile if and
only if they are used by the project. Fixing issues of this nature only
requires calling \code{snapshot()} because there are four possibilities for
a package:
\itemize{
\item If it's used and recorded, it's ok.
\item If it's used and not recorded, call \code{renv::snapshot()} to add it to the
lockfile.
\item If it's not used but is recorded, call \code{renv::snapshot()} to remove
it from the lockfile.
\item If it's not used and not recorded, it's also ok, as it may be a
development dependency.
}
}
\section{Out-of-sync sources}{
The final issue to resolve is any inconsistencies between the version of
the package recorded in the lockfile and the version installed in your
library. To fix these issues you'll need to either call \code{renv::restore()}
or \code{renv::snapshot()}:
\itemize{
\item Call \code{renv::snapshot()} if your project code is working. This implies that
the library is correct and you need to update your lockfile.
\item Call \code{renv::restore()} if your project code isn't working. This probably
implies that you have the wrong package versions installed and you need
to restore from known good state in the lockfile.
}
If you're not sure which case applies, it's generally safer to call
\code{renv::snapshot()}. If you want to rollback to an earlier known good
status, see \code{\link[=history]{history()}} and \code{\link[=revert]{revert()}}.
}
\section{Different R Version}{
renv will also notify you if the version of R used when the lockfile was
generated, and the version of R currently in use, do not match. In this
scenario, you'll need to consider:
\itemize{
\item Is the version of R recorded in the lockfile correct? If so, you'll want
to ensure that version of R is installed and used when working in this
project.
\item Otherwise, you can call \code{renv::snapshot()} to update the version of R
recorded in the lockfile, to match the version of R currently in use.
}
If you'd like to set the version of R recorded in a lockfile independently
of the version of R currently in use, you can set the \code{r.version} project
setting -- see \link{settings} for more details.
}
\examples{
\dontrun{
# disable automatic snapshots
auto.snapshot <- getOption("renv.config.auto.snapshot")
options(renv.config.auto.snapshot = FALSE)
# initialize a new project (with an empty R library)
renv::init(bare = TRUE)
# install digest 0.6.19
renv::install("digest@0.6.19")
# save library state to lockfile
renv::snapshot()
# remove digest from library
renv::remove("digest")
# check library status
renv::status()
# restore lockfile, thereby reinstalling digest 0.6.19
renv::restore()
# restore automatic snapshots
options(renv.config.auto.snapshot = auto.snapshot)
}
}
renv/man/clean.Rd 0000644 0001762 0000144 00000004775 14441721610 013365 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/clean.R
\name{clean}
\alias{clean}
\title{Clean a project}
\usage{
clean(project = NULL, ..., actions = NULL, prompt = interactive())
}
\arguments{
\item{project}{The project directory. If \code{NULL}, then the active project will
be used. If no project is currently active, then the current working
directory is used instead.}
\item{...}{Unused arguments, reserved for future expansion. If any arguments
are matched to \code{...}, renv will signal an error.}
\item{actions}{The set of clean actions to take. See the documentation in
\strong{Actions} for a list of available actions, and the default actions
taken when no actions are supplied.}
\item{prompt}{Boolean; prompt the user before taking any action? For backwards
compatibility, \code{confirm} is accepted as an alias for \code{prompt}.}
}
\value{
The project directory, invisibly. Note that this function is normally
called for its side effects.
}
\description{
Clean up a project and its associated \R libraries.
}
\section{Actions}{
The following clean actions are available:
\describe{
\item{\code{package.locks}}{
During package installation, \R will create package locks in the
library path, typically named \verb{00LOCK-}. On occasion, if package
installation fails or \R is terminated while installing a package, these
locks can be left behind and will inhibit future attempts to reinstall
that package. Use this action to remove such left-over package locks.
}
\item{\code{library.tempdirs}}{
During package installation, \R may create temporary directories with
names of the form \verb{file\\w\{12\}}, and on occasion those files can be
left behind even after they are no longer in use. Use this action to
remove such left-over directories.
}
\item{\code{system.library}}{
In general, it is recommended that only packages distributed with \R
are installed into the default library (the library path referred to
by \code{.Library}). Use this action to remove any user-installed packages
that have been installed to the system library.
Because this action is destructive, it is by default never run -- it
must be explicitly requested by the user.
}
\item{\code{unused.packages}}{
Remove packages that are installed in the project library, but no longer
appear to be used in the project sources.
Because this action is destructive, it is by default only run in
interactive sessions when prompting is enabled.
}
}
}
\examples{
\dontrun{
# clean the current project
renv::clean()
}
}
renv/man/migrate.Rd 0000644 0001762 0000144 00000003501 14441721610 013715 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/migrate.R
\name{migrate}
\alias{migrate}
\title{Migrate a project from packrat to renv}
\usage{
migrate(
project = NULL,
packrat = c("lockfile", "sources", "library", "options", "cache")
)
}
\arguments{
\item{project}{The project directory. If \code{NULL}, then the active project will
be used. If no project is currently active, then the current working
directory is used instead.}
\item{packrat}{Components of the Packrat project to migrate. See the default
argument list for components of the Packrat project that can be migrated.
Select a subset of those components for migration as appropriate.}
}
\value{
The project directory, invisibly. Note that this function is normally
called for its side effects.
}
\description{
Migrate a project's infrastructure from packrat to renv.
}
\section{Migration}{
When migrating Packrat projects to renv, the set of components migrated
can be customized using the \code{packrat} argument. The set of components that
can be migrated are as follows:
\tabular{ll}{
\strong{Name} \tab \strong{Description} \cr
\code{lockfile} \tab
Migrate the Packrat lockfile (\code{packrat/packrat.lock}) to the renv lockfile
(\code{renv.lock}). \cr
\code{sources} \tab
Migrate package sources from the \code{packrat/src} folder to the renv
sources folder. Currently, only CRAN packages are migrated to renv --
packages retrieved from other sources (e.g. GitHub) are ignored.
\cr
\code{library} \tab
Migrate installed packages from the Packrat library to the renv project
library.
\cr
\code{options} \tab
Migrate compatible Packrat options to the renv project.
\cr
\code{cache} \tab
Migrate packages from the Packrat cache to the renv cache.
\cr
}
}
\examples{
\dontrun{
# migrate Packrat project infrastructure to renv
renv::migrate()
}
}
renv/man/project.Rd 0000644 0001762 0000144 00000001014 14441721610 013730 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/project.R
\name{project}
\alias{project}
\title{Retrieve the active project}
\usage{
project(default = NULL)
}
\arguments{
\item{default}{The value to return when no project is
currently active. Defaults to \code{NULL}.}
}
\value{
The active project directory, as a length-one character vector.
}
\description{
Retrieve the path to the active project (if any).
}
\examples{
\dontrun{
# get the currently-active renv project
renv::project()
}
}
renv/man/activate.Rd 0000644 0001762 0000144 00000004144 14567447703 014112 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/activate.R, R/deactivate.R
\name{activate}
\alias{activate}
\alias{deactivate}
\title{Activate or deactivate a project}
\usage{
activate(project = NULL, profile = NULL)
deactivate(project = NULL, clean = FALSE)
}
\arguments{
\item{project}{The project directory. If \code{NULL}, then the active project will
be used. If no project is currently active, then the current working
directory is used instead.}
\item{profile}{The profile to be activated. See
\code{vignette("profiles", package = "renv")} for more information.}
\item{clean}{If \code{TRUE}, will also remove the \verb{renv/} directory and the
lockfile.}
}
\value{
The project directory, invisibly. Note that this function is normally
called for its side effects.
}
\description{
\code{activate()} enables renv for a project in both the current session and
in all future sessions. You should not generally need to call \code{activate()}
yourself as it's called automatically by \code{\link[=init]{init()}}, which is the best
way to start using renv in a new project.
\code{activate()} first calls \code{\link[=scaffold]{scaffold()}} to set up the project
infrastructure. Most importantly, this creates a project library and adds a
an auto-loader to \code{.Rprofile} to ensure that the project library is
automatically used for all future instances of the project. It then restarts
the session to use that auto-loader.
\code{deactivate()} removes the infrastructure added by \code{activate()}, and
restarts the session. By default it will remove the auto-loader from the
\code{.Rprofile}; use \code{clean = TRUE} to also delete the lockfile and the project
library.
}
\section{Temporary deactivation}{
If you need to temporarily disable autoload activation you can set
the \code{RENV_CONFIG_AUTOLOADER_ENABLED} envvar, e.g.
\code{Sys.setenv(RENV_CONFIG_AUTOLOADER_ENABLED = "false")}.
}
\examples{
\dontrun{
# activate the current project
renv::activate()
# activate a separate project
renv::activate(project = "~/projects/analysis")
# deactivate the currently-activated project
renv::deactivate()
}
}
renv/man/sandbox.Rd 0000644 0001762 0000144 00000005441 14464550375 013745 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sandbox.R
\docType{data}
\name{sandbox}
\alias{sandbox}
\title{The default library sandbox}
\usage{
sandbox
}
\description{
An \R installation can have up to three types of library paths available
to the user:
\itemize{
\item The \emph{user library}, where \R packages downloaded and installed by the
current user are installed. This library path is only visible to that
specific user.
\item The \emph{site library}, where \R packages maintained by administrators of a
system are installed. This library path, if it exists, is visible to all
users on the system.
\item The \emph{default library}, where \R packages distributed with \R itself are
installed. This library path is visible to all users on the system.
}
Normally, only so-called "base" and "recommended" packages should be installed
in the default library. (You can get a list of these packages with
\code{installed.packages(priority = c("base", "recommended"))}). However, it is
possible for users and administrators to install packages into the default
library, if the filesystem permissions permit them to do so. (This, for
example, is the default behavior on macOS.)
Because the site and default libraries are visible to all users, having those
accessible in renv projects can potentially break isolation -- that is,
if a package were updated in the default library, that update would be visible
to all \R projects on the system.
To help defend against this, renv uses something called the "sandbox" to
isolate renv projects from non-"base" packages that are installed into the
default library. When an renv project is loaded, renv will:
\itemize{
\item Create a new, empty library path (called the "sandbox"),
\item Link only the "base" and "recommended" packages from the default library
into the sandbox,
\item Mark the sandbox as read-only, so that users are unable to install packages
into this library,
\item Instruct the \R session to use the "sandbox" as the default library.
}
This process is mostly transparent to the user. However, because the sandbox
is read-only, if you later need to remove the sandbox, you'll need to reset
file permissions manually; for example, with \code{renv::sandbox$unlock()}.
If you'd prefer to keep the sandbox unlocked, you can also set:
\if{html}{\out{
}}
The sandbox library path can also be configured using the \code{RENV_PATHS_SANDBOX}
environment variable: see \link{paths} for more details.
}
\keyword{datasets}
renv/man/use_python.Rd 0000644 0001762 0000144 00000012067 14441721611 014472 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/use-python.R
\name{use_python}
\alias{use_python}
\title{Use python}
\usage{
use_python(
python = NULL,
...,
type = c("auto", "virtualenv", "conda", "system"),
name = NULL,
project = NULL
)
}
\arguments{
\item{python}{The path to the version of Python to be used with this project. See
\strong{Finding Python} for more details.}
\item{...}{Optional arguments; currently unused.}
\item{type}{The type of Python environment to use. When \code{"auto"} (the default),
virtual environments will be used.}
\item{name}{The name or path that should be used for the associated Python environment.
If \code{NULL} and \code{python} points to a Python executable living within a
pre-existing virtual environment, that environment will be used. Otherwise,
a project-local environment will be created instead, using a name
generated from the associated version of Python.}
\item{project}{The project directory. If \code{NULL}, then the active project will
be used. If no project is currently active, then the current working
directory is used instead.}
}
\value{
\code{TRUE}, indicating that the requested version of Python has been
successfully activated. Note that this function is normally called for its
side effects.
}
\description{
Associate a version of Python with your project.
}
\details{
When Python integration is active, renv will:
\itemize{
\item Save metadata about the requested version of Python in \code{renv.lock} -- in
particular, the Python version, and the Python type ("virtualenv", "conda",
"system"),
\item Capture the set of installed Python packages during \code{renv::snapshot()},
\item Re-install the set of recorded Python packages during \code{renv::restore()}.
}
In addition, when the project is loaded, the following actions will be taken:
\itemize{
\item The \code{RENV_PYTHON} environment variable will be set, indicating the version
of Python currently active for this sessions,
\item The \code{RETICULATE_PYTHON} environment variable will be set, so that the
reticulate package can automatically use the requested copy of Python
as appropriate,
\item The requested version of Python will be placed on the \code{PATH}, so that
attempts to invoke Python will resolve to the expected version of Python.
}
You can override the version of Python used in a particular project by
setting the \code{RENV_PYTHON} environment variable; e.g. as part of the
project's \code{.Renviron} file. This can be useful if you find that renv
is unable to automatically discover a compatible version of Python to
be used in the project.
}
\section{Finding Python}{
In interactive sessions, when \code{python = NULL}, renv will prompt for an
appropriate version of Python. renv will search a pre-defined set of
locations when attempting to find Python installations on the system:
\itemize{
\item \code{getOption("renv.python.root")},
\item \verb{/opt/python},
\item \verb{/opt/local/python},
\item \verb{~/opt/python},
\item \verb{/usr/local/opt} (for macOS Homebrew-installed copies of Python),
\item \verb{/opt/homebrew/opt} (for M1 macOS Homebrew-installed copies of Python),
\item \verb{~/.pyenv/versions},
\item Python instances available on the \code{PATH}.
}
In non-interactive sessions, renv will first check the \code{RETICULATE_PYTHON}
environment variable; if that is unset, renv will look for Python on the
\code{PATH}. It is recommended that the version of Python to be used is explicitly
supplied for non-interactive usages of \code{use_python()}.
}
\section{Warning}{
We strongly recommend using Python virtual environments, for a few reasons:
\enumerate{
\item If something goes wrong with a local virtual environment, you can safely
delete that virtual environment, and then re-initialize it later, without
worry that doing so might impact other software on your system.
\item If you choose to use a "system" installation of Python, then any packages
you install or upgrade will be visible to any other application that
wants to use that same Python installation. Using a virtual environment
ensures that any changes made are isolated to that environment only.
\item Choosing to use Anaconda will likely invite extra frustration in the
future, as you may be required to upgrade and manage your Anaconda
installation as new versions of Anaconda are released. In addition,
Anaconda installations tend to work poorly with software not specifically
installed as part of that same Anaconda installation.
}
In other words, we recommend selecting "system" or "conda" only if you are an
expert Python user who is already accustomed to managing Python / Anaconda
installations on your own.
}
\examples{
\dontrun{
# use python with a project
renv::use_python()
# use python with a project; create the environment
# within the project directory in the '.venv' folder
renv::use_python(name = ".venv")
# use python with a pre-existing virtual environment located elsewhere
renv::use_python(name = "~/.virtualenvs/env")
# use virtualenv python with a project
renv::use_python(type = "virtualenv")
# use conda python with a project
renv::use_python(type = "conda")
}
}
renv/man/embed.Rd 0000644 0001762 0000144 00000007711 14464550375 013365 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/embed.R, R/use.R
\name{embed}
\alias{embed}
\alias{use}
\title{Capture and re-use dependencies within a \code{.R} or \code{.Rmd}}
\usage{
embed(path = NULL, ..., lockfile = NULL, project = NULL)
use(
...,
lockfile = NULL,
library = NULL,
isolate = sandbox,
sandbox = TRUE,
attach = FALSE,
verbose = TRUE
)
}
\arguments{
\item{path}{The path to an \R or R Markdown script. The default will use the current
document, if running within RStudio.}
\item{...}{The \R packages to be used with this script. Ignored if \code{lockfile} is
non-\code{NULL}.}
\item{lockfile}{The lockfile to use. When supplied, renv will use the packages as
declared in the lockfile.}
\item{project}{The project directory. If \code{NULL}, then the active project will
be used. If no project is currently active, then the current working
directory is used instead.}
\item{library}{The library path into which the requested packages should be installed.
When \code{NULL} (the default), a library path within the \R temporary
directory will be generated and used. Note that this same library path
will be re-used on future calls to \code{renv::use()}, allowing \code{renv::use()}
to be used multiple times within a single script.}
\item{isolate}{Boolean; should the active library paths be included in the set of library
paths activated for this script? Set this to \code{TRUE} if you only want the
packages provided to \code{renv::use()} to be visible on the library paths.}
\item{sandbox}{Should the system library be sandboxed? See the sandbox documentation in
\link{config} for more details. You can also provide an explicit sandbox
path if you want to configure where \code{renv::use()} generates its sandbox.
By default, the sandbox is generated within the \R temporary directory.}
\item{attach}{Boolean; should the set of requested packages be automatically attached?
If \code{TRUE}, packages will be loaded and attached via a call
to \code{\link[=library]{library()}} after install. Ignored if \code{lockfile} is non-\code{NULL}.}
\item{verbose}{Boolean; be verbose while installing packages?}
}
\value{
This function is normally called for its side effects.
}
\description{
Together, \code{embed()} and \code{use()} provide a lightweight way to specify and
restore package versions within a file. \code{use()} is a lightweight lockfile
specification that \code{embed()} can automatically generate and insert into a
script or document.
Calling \code{embed()} inspects the dependencies of the specified document then
generates and inserts a call to \code{use()} that looks something like this:
\if{html}{\out{
}}
Then, when you next run your R script or render your \code{.Rmd}, \code{use()} will:
\enumerate{
\item Create a temporary library path.
\item Install the requested packages and their recursive dependencies into that
library.
\item Activate the library, so it's used for the rest of the script.
}
\subsection{Manual usage}{
You can also create calls to \code{use()} yourself, either specifying the
packages needed by hand, or by supplying the path to a lockfile,
\code{renv::use(lockfile = "/path/to/renv.lock")}.
This can be useful in projects where you'd like to associate different
lockfiles with different documents, as in a blog where you want each
post to capture the dependencies at the time of writing. Once you've
finished writing each, the post, you can use
\code{renv::snapshot(lockfile = "/path/to/renv.lock")}
to "save" the state that was active while authoring that bost, and then use
\code{renv::use(lockfile = "/path/to/renv.lock")} in that document to ensure the
blog post always uses those dependencies onfuture renders.
\code{renv::use()} is inspired in part by the \href{https://groundhogr.com/}{groundhog}
package, which also allows one to specify a script's \R package requirements
within that same \R script.
}
}
renv/man/purge.Rd 0000644 0001762 0000144 00000003437 14441721610 013417 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/purge.R
\name{purge}
\alias{purge}
\title{Purge packages from the cache}
\usage{
purge(package, ..., version = NULL, hash = NULL, prompt = interactive())
}
\arguments{
\item{package}{A single package to be removed from the cache.}
\item{...}{Unused arguments, reserved for future expansion. If any arguments
are matched to \code{...}, renv will signal an error.}
\item{version}{The package version to be removed. When \code{NULL}, all versions
of the requested package will be removed.}
\item{hash}{The specific hashes to be removed. When \code{NULL}, all hashes
associated with a particular package's version will be removed.}
\item{prompt}{Boolean; prompt the user before taking any action? For backwards
compatibility, \code{confirm} is accepted as an alias for \code{prompt}.}
}
\value{
The set of packages removed from the renv global cache,
as a character vector of file paths.
}
\description{
Purge packages from the cache. This can be useful if a package which had
previously been installed in the cache has become corrupted or unusable,
and needs to be reinstalled.
}
\details{
\code{purge()} is an inherently destructive option. It removes packages from the
cache, and so any project which had symlinked that package into its own
project library would find that package now unavailable. These projects would
hence need to reinstall any purged packages. Take heed of this in case you're
looking to purge the cache of a package which is difficult to install, or
if the original sources for that package are no longer available!
}
\examples{
\dontrun{
# remove all versions of 'digest' from the cache
renv::purge("digest")
# remove only a particular version of 'digest' from the cache
renv::purge("digest", version = "0.6.19")
}
}
renv/man/figures/ 0000755 0001762 0000144 00000000000 14257631444 013455 5 ustar ligges users renv/man/figures/logo.svg 0000644 0001762 0000144 00000215526 14257631444 015151 0 ustar ligges users