Debian Codegraph @

man/activate.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/activate.R, R/deactivate.R
3 \name{activate}
4 \alias{activate}
5 \alias{deactivate}
6 \title{Activate or deactivate a project}
7 \usage{
8 activate(project = NULL, profile = NULL)
9
10 deactivate(project = NULL, clean = FALSE)
11 }
12 \arguments{
13 \item{project}{The project directory. If \code{NULL}, then the active project will
14 be used. If no project is currently active, then the current working
15 directory is used instead.}
16
17 \item{profile}{The profile to be activated. See
18 \code{vignette("profiles", package = "renv")} for more information.
19 When \code{NULL} (the default), the profile is not changed. Use
20 \code{profile = "default"} to revert to the default \code{renv} profile.}
21
22 \item{clean}{If \code{TRUE}, will also remove the \verb{renv/} directory and the
23 lockfile.}
24 }
25 \value{
26 The project directory, invisibly. Note that this function is normally
27 called for its side effects.
28 }
29 \description{
30 \code{activate()} enables renv for a project in both the current session and
31 in all future sessions. You should not generally need to call \code{activate()}
32 yourself as it's called automatically by \code{\link[=init]{init()}}, which is the best
33 way to start using renv in a new project.
34
35 \code{activate()} first calls \code{\link[=scaffold]{scaffold()}} to set up the project
36 infrastructure. Most importantly, this creates a project library and adds a
37 an auto-loader to \code{.Rprofile} to ensure that the project library is
38 automatically used for all future instances of the project. It then restarts
39 the session to use that auto-loader.
40
41 \code{deactivate()} removes the infrastructure added by \code{activate()}, and
42 restarts the session. By default it will remove the auto-loader from the
43 \code{.Rprofile}; use \code{clean = TRUE} to also delete the lockfile and the project
44 library.
45 }
46 \section{Temporary deactivation}{
47 If you need to temporarily disable autoload activation you can set
48 the \code{RENV_CONFIG_AUTOLOADER_ENABLED} envvar, e.g.
49 \code{Sys.setenv(RENV_CONFIG_AUTOLOADER_ENABLED = "false")}.
50 }
51
52 \examples{
53 \dontrun{
54
55 # activate the current project
56 renv::activate()
57
58 # activate a separate project
59 renv::activate(project = "~/projects/analysis")
60
61 # deactivate the currently-activated project
62 renv::deactivate()
63
64 }
65 }