sopkgs: Temporarily install a package in the current R session

Description Usage Arguments Details Note Author(s) See Also Examples

View source: R/sopkgs.R

Description

This function can be useful when a package is necessary to try to answer a question on StackOverflow and you know that you won't need it anymore afterward. It will install one or several packages only for the current R session.

Usage

1
sopkgs(package, dependencies = TRUE, ...)

Arguments

package

character. A package name, or vector of package names.

dependencies

logical. Argument passed to install.packages. Defaults to TRUE.

...

Other arguments passed to install.packages.

Details

The files are downloaded and installed in a temporary directory, and this directory is temporarily added to the library tree within which packages are looked for: (.libPaths). If you start another R session, the package won't be accessible as it won't be in the library tree anymore, and as the files are installed in a temporary directory they should be deleted upon next reboot (this depends on your operating system).

Note

You can find alternative functions in the original question and answers on StackOverflow :

http://stackoverflow.com/questions/14896941/install-an-r-package-temporarily-only-for-the-current-session

Author(s)

Julien Barnier <julien@nozav.org>

See Also

install.packages, .libPaths

Examples

1
2
3
4
5
## Not run: 
## Temporarily install the ggplot2 package in the current R session
sopkgs("ggplot2")

## End(Not run)

sebastian-c/overflow documentation built on May 29, 2019, 4:56 p.m.