-
Notifications
You must be signed in to change notification settings - Fork 2
/
06-dependencies.Rmd
46 lines (30 loc) · 1.02 KB
/
06-dependencies.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
```{r echo = FALSE}
knitr::opts_chunk$set(
comment = "#>",
warning = FALSE,
message = FALSE
)
```
# Dependencies {#dependencies}
Dependencies = other R packages.
There are (mostly) three types:
* Depends
* Imports
* Suggests
`Enhances` is used rarely
## Adding dependencies
- Add an entry in the `DESCRIPTION` file
- Add a declaration of what you are importing from the package:
+ all of the package, or (`@import package`)
+ certain functions (`@importFrom package function`)
+ there's no standard for where to do this.
+ i like to do in a package named manual file (e.g., `foobar-package.R`) so you can keep track of all imports in one place
+ but some like to list imports in each file/function where they are used
You can do this manually or via `usethis::use_package('package_name')`
## Add a dependency to a package
### Exercise
Choose a package that's easy for you to work with.
Add it to your package
Reinstall and load your package
Does it work?
## BONUS: What are system dependencies?