1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/packrat.R
\name{init}
\alias{init}
\title{Initialize Packrat on a new or existing \R project}
\usage{
init(
project = ".",
options = NULL,
enter = TRUE,
restart = enter,
infer.dependencies = TRUE
)
}
\arguments{
\item{project}{The directory that contains the \R project.}
\item{options}{An \R \code{list} of options, as specified in
\code{\link{packrat-options}}.}
\item{enter}{Boolean, enter packrat mode for this project after finishing a init?}
\item{restart}{If \code{TRUE}, restart the R session after init.}
\item{infer.dependencies}{If \code{TRUE}, infer package dependencies by
examining the \R code.}
}
\description{
Given a project directory, makes a new packrat project in the directory.
}
\details{
\code{init} works as follows:
\enumerate{
\item Application dependencies are computed by examining the \R code
throughout the project for \code{library} and \code{require} calls. You can
opt out of this behavior by setting \code{infer.dependencies} to
\code{FALSE}.
\item A snapshot is taken of the version of each package currently used by
the project as described in \code{\link{snapshot}}, and each package's
sources are downloaded.
\item A private library is created in the directory.
\item The snapshot is applied to the directory as described in
\code{\link{restore}}. } When \code{init} is finished, all the packages
on which the project depends are installed in a new, private library located
inside the project directory.
\strong{You must restart your \R session in the given project directory after
running \code{init} in order for the changes to take effect!}
When \R is started in the directory, it will use the new, private library.
Calls to \code{\link{require}} and \code{\link{library}} will load packages
from the private library (except for 'base' or 'recommended' \R packages,
which are found in the system library), and functions such as \code{\link{install.packages}}
will modify that private library. You can sync this private library with
packrat using \code{\link{snapshot}} and \code{\link{restore}}.
}
\note{
The \code{restart} parameter will only result in a restart of R when the
R environment packrat is running within makes available a restart function
via \code{getOption("restart")}.
}
\examples{
\dontrun{
## initialize a project using a local repository of packages
packrat::init(options = list(local.repos = "~/projects/R"))
}
}
\seealso{
\link{packrat} for a description of the files created by
\code{init}.
}
|