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.
sopkgs(package, dependencies = TRUE, ...)
package | character. A package name, or vector of package names. |
---|---|
dependencies | logical. Argument passed to |
... | Other arguments passed to |
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).
You can find alternative functions in the original question and answers on StackOverflow :
Julien Barnier <julien@nozav.org>
if (FALSE) { ## Temporarily install the ggplot2 package in the current R session sopkgs("ggplot2") }