You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: R/checkpoint.R
+62-30Lines changed: 62 additions & 30 deletions
Original file line number
Diff line number
Diff line change
@@ -6,13 +6,13 @@
6
6
#'
7
7
#' \code{checkpoint()} creates a local library into which it installs a copy of the packages required by your project as they existed on CRAN on the specified snapshot date. Your R session is updated to use only these packages.
8
8
#'
9
-
#' To automatically determine all packages used in your project, the function scans all R code (\code{.R}, \code{.Rmd}, and \code{.Rpres} files) for \code{library()} and \code{requires()} statements.
9
+
#' To automatically determine all packages used in your project, the function scans all R code (\code{.R}, \code{.Rmd}, and \code{.Rpres} files) for \code{\link{library}()} and \code{\link{require}()} statements. In addition, scans for occurrences of code that accesses functions in namespaces using \code{package}\code{\link[base]{::}}\code{foo()} and \code{package}\code{\link[base]{:::}}\code{foo()}. Finally, any occurrences of the functions \code{\link[methods]{setClass}}, \code{\link[methods]{setRefClass}}, \code{\link[methods]{setMethod}} or \code{\link[methods]{setGeneric}} will also identify the \code{methods} package as a dependency.
10
10
#'
11
11
#' Specifically, the function will:
12
12
#'
13
13
#' \itemize{
14
-
#' \item{Create a new local snapshot library to install packages. This library folder is at \code{~/.checkpoint}}
15
-
#' \item{Update the options for your CRAN mirror and point to an MRAN snapshot using \code{options(repos)}}
14
+
#' \item{Create a new local snapshot library to install packages. By default this library folder is at \code{~/.checkpoint}} but you can modify the path using the \code{checkpointLocation} argument.
15
+
#' \item{Update the options for your CRAN mirror and point to an MRAN snapshot using \code{\link[base]{options}(repos)}}
16
16
#' \item{Scan your project folder for all required packages and install them from the snapshot using \code{\link[utils]{install.packages}}}
17
17
#' }
18
18
#'
@@ -23,8 +23,12 @@
23
23
#'
24
24
#' @param project A project path. This is the path to the root of the project that references the packages to be installed from the MRAN snapshot for the date specified for \code{snapshotDate}. Defaults to current working directory using \code{\link{getwd}()}.
25
25
#'
26
-
#' @param R.version Optional character string, e.g. "3.1.2". If specified, compares the current R.version to the specified R.version, and warns if these are different. This argument allows the original script author to specify a specific version of R to obtain the desired results.
26
+
#' @param R.version Optional character string, e.g. "3.1.2". If specified, compares the current \code{\link[base]{R.version}} to the specified R.version. If these differ, stops processing with an error, making no changes to the system. Specifically, if the check fails, the library path is NOT modified. This argument allows the original script author to specify a specific version of R to obtain the desired results.
27
27
#'
28
+
#' @param scanForPackages If TRUE, scans for packages in project folder (see details). If FALSE, skips the scanning process. A use case for \code{scanForPackages = FALSE} is to skip the scanning and installation process, e.g. in production environments with a large number of R scripts in the project. Only set \code{scanForPackages = FALSE} if you are certain that all package dependencies are already in the checkpoint folder.
29
+
#'
30
+
#' @param checkpointLocation File path where the checkpoint library is stored. Default is \code{"~/"}, i.e. the user's home directory. A use case for changing this is to create a checkpoint library on a portable drive (e.g. USB drive).
31
+
#'
28
32
#' @param use.knitr If TRUE, uses parses all \code{Rmarkdown} files using the \code{knitr} package.
29
33
#'
30
34
#' @param verbose If TRUE, displays progress messages.
0 commit comments