init | R Documentation |
Call renv::init()
to start using renv in the current project. This will:
Set up project infrastructure (as described in scaffold()
) including
the project library and the .Rprofile
that ensures renv will be
used in all future sessions,
Discover the packages that are currently being used in your project
(via dependencies()
), and install them into the project library
(as described in hydrate()
),
Create a lockfile that records the state of the project library so it
can be restored by others (as described in snapshot()
),
Restart R (if running inside RStudio).
If you call 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.
init(
project = NULL,
...,
profile = NULL,
settings = NULL,
bare = FALSE,
force = FALSE,
repos = NULL,
bioconductor = NULL,
load = TRUE,
restart = interactive()
)
project |
The project directory. When |
... |
Unused arguments, reserved for future expansion. If any arguments
are matched to |
profile |
The profile to be activated. See
|
settings |
A list of settings to be used with the newly-initialized project. |
bare |
Boolean; initialize the project with an empty project library, without attempting to discover and install R package dependencies? |
force |
Boolean; force initialization? By default, renv will refuse
to initialize the home directory as a project, to defend against accidental
misusages of |
repos |
The R repositories to be used in this project. See Repositories for more details. |
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 |
load |
Boolean; should the project be loaded after it is initialized? |
restart |
Boolean; attempt to restart the R session after initializing
the project? A session restart will be attempted if the |
The project directory, invisibly. Note that this function is normally called for its side effects.
If the default R repositories have not already been set, renv will use
the 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 config()
for more details.
## Not run:
# 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)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.