Title: | Attaches and Installs Packages |
---|---|
Description: | A simple function for easier package loading and auto-installation. |
Authors: | Josh Katz [aut, cre] |
Maintainer: | Josh Katz <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.0.3 |
Built: | 2025-02-15 03:08:30 UTC |
Source: | https://github.com/joshkatz/needs |
needs is a simple R function to make package loading /
installation hassle-free — use it in place of library
to attach
packages and automatically install any that are missing. You can also supply
a minimum version number, and it will update old packages as needed. No more
changing your code to reinstall packages every time you update R —
needs
does it for you.
Josh Katz
Source repo: http://www.github.com/joshkatz/needs
needs
loads and attaches packages, automatically
installing (and attaching) any it can't find in your libraries. It accepts
any number of arguments, given as names or character strings. Optionally,
supply a minimum version on a per-package basis to update old packages as
needed.
needs(..., .printConflicts = F)
needs(..., .printConflicts = F)
... |
Packages, given as unquoted names or character strings. Specify a
required package version as |
.printConflicts |
Logical, specifying whether to print a summary of
objects that exist in multiple places on the search path along with their
respective locations. Set to |
Recommended use is to allow the function to autoload when prompted
the first time the package is loaded interactively. To change this setting
later, run needs:::autoload(TRUE)
or needs:::autoload(FALSE)
to turn autoloading on or off, respectively.
## Not run: needs() # returns NULL needs(foo, bar) # require a minimum version needs(foo, bar = "0.9.1", baz = "0.4.3") ## End(Not run)
## Not run: needs() # returns NULL needs(foo, bar) # require a minimum version needs(foo, bar = "0.9.1", baz = "0.4.3") ## End(Not run)
prioritize
detaches packages from the search path, then
re-attaches them, placing them at the beginning of the search path to
prevent masking. This allows for the loading of packages with conflicting
function names in any order.
prioritize(...)
prioritize(...)
... |
Packages, given as unquoted names or character strings. Earlier arguments will be attached later (and therefore get a higher priority). |
If you find yourself calling this function a lot, you're probably doing something wrong.
## Not run: # loading plyr after dplyr causes badness needs(dplyr, plyr) # prioritize the functions in dplyr prioritize(dplyr) ## End(Not run)
## Not run: # loading plyr after dplyr causes badness needs(dplyr, plyr) # prioritize the functions in dplyr prioritize(dplyr) ## End(Not run)
Exports the package functionality to .Rprofile in the current working directory. Now the same code you run can be run on another system without requiring any extra installation or throwing errors for uninstalled packages.
toProfile(dir = NULL, append = T)
toProfile(dir = NULL, append = T)
dir |
Target directory for Rprofile. Defaults to working directory. |
append |
Whether to append to the current Rprofile, if one exists. Set to false to overwrite. |
## Not run: toProfile() ## End(Not run)
## Not run: toProfile() ## End(Not run)