Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joshkatz/needs
An R function for safe package loading / installation.
https://github.com/joshkatz/needs
Last synced: 8 days ago
JSON representation
An R function for safe package loading / installation.
- Host: GitHub
- URL: https://github.com/joshkatz/needs
- Owner: joshkatz
- License: other
- Created: 2015-12-07T23:13:04.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2019-02-25T14:58:50.000Z (almost 6 years ago)
- Last Synced: 2024-11-17T15:56:35.448Z (25 days ago)
- Language: R
- Size: 33.2 KB
- Stars: 75
- Watchers: 4
- Forks: 3
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - joshkatz/needs - An R function for safe package loading / installation. (R)
README
# needs
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/needs)](http://cran.r-project.org/package=needs)`needs` is a simple R package 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.
```r
install.packages("needs")
# for the dev version:
# devtools::install_github("joshkatz/needs", ref = "development")
library(needs)# answer "yes" when prompted, and you will never have
# to type library or install.packages again. hooray.
```### Usage
Once installed, use just as you would `library`. With the added bonus of being able to give multiple unquoted arguments in one single function call. Specify a required package version with a pairlist:```r
needs(foo,
bar = "0.9.1",
baz = "0.4.3")
```### Rprofile
`needs` can help make code-sharing easier. In your project directory:```r
needs::toProfile()
```
This extracts the package contents and appends it to the Rprofile in your working directory. Now if someone else clones your project, your code runs without requiring any extra installation or throwing errors for uninstalled packages.