set_lib_dir: Location of the package cache

Description Usage Arguments Details Value Examples

View source: R/lib_dir.R

Description

set_lib_dir() specifies where packages will be downloaded to. get_lib_dir() returns this directory. clear_lib_dir() deletes all downloaded packages.

Usage

1
2
3
4
5
set_lib_dir(lib_dir, create = FALSE)

get_lib_dir()

clear_lib_dir()

Arguments

lib_dir

Path to a directory, or NULL to unset.

create

Logical. Try to create the directory if it doesn't exist.

Details

If lib_dir is set to NULL, a subdirectory of tempdir() will be used. lib_dir will be normalized via normalizePath().

The package cache is under the directory specified by getOption("apicheck.lib_dir"), or, if that is unset, in a per-session temporary directory. You should use set_lib_dir() to change this rather than setting the option directly. Within this directory, subdirectories are named like package-version, e.g. longurl-0.3.0. Within these subdirectories are the actual installed libraries. So, lib_dir is not appropriate for passing to functions like library. To load a library from the cache yourself, do e.g. library("blah", lib.loc = file.path(get_lib_dir(), "blah-0.1.0")).

Value

set_lib_dir invisibly returns the old library location, or NULL if none was set in options.

get_lib_dir returns the actual library location, whether or not an option has been set.

clear_lib_dir invisibly returns TRUE if all files and directories could be removed, FALSE otherwise.

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
set_lib_dir("~/.apicheck")

## End(Not run)
get_lib_dir()
## Not run: 
clear_lib_dir()

## End(Not run)

hughjonesd/apicheck documentation built on July 17, 2018, 7:21 a.m.