forked from tidyverse/design
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdef-user.qmd
26 lines (16 loc) · 854 Bytes
/
def-user.qmd
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
# User settable defaults {#sec-def-user}
```{r}
#| include = FALSE
source("common.R")
```
## What's the pattern?
It's sometimes useful to give the user control over default values, so that they can set once per session or once for every session in their `.Rprofile`.
To do so, use `getOption()` in the default value.
Note that this pattern should general only be used to control the side-effects of a function, not its compute value.
The two primary uses are for controlling the appearance of output, particularly in `print()` methods, and for setting default values in generated templates.
Related patterns:
- If a global option affects the results of the computation (not just its side-effects), you have an example of @sec-inputs-explicit.
## What are some examples?
## Why is it important?
## What are the exceptions?
## How do I use it?