-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathreadme-src.Rmd
49 lines (39 loc) · 1.67 KB
/
readme-src.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
---
output:
html_document:
keep_md: yes
variant: markdown_github
---
<!-- README.md is generated from readme-src.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "# >",
fig.path = "README-"
)
options(repos = "https://cran.rstudio.com/")
```
# 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 eval = F}
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 eval = F}
needs(foo,
bar = "0.9.1",
baz = "0.4.3")
```
### Rprofile
`needs` can help make code-sharing easier. In your project directory:
```{r eval = F}
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.