-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathREADME.Rmd
61 lines (44 loc) · 1.46 KB
/
README.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
50
51
52
53
54
55
56
57
58
59
60
61
---
output:
md_document:
variant: markdown_github
---
[![build status](https://travis-ci.org/goldingn/default.svg?branch=master)](https://travis-ci.org/goldingn/default)
[![codecov.io](https://codecov.io/github/goldingn/default/coverage.svg?branch=master)](https://codecov.io/github/goldingn/default?branch=master)
[![cran version](http://www.r-pkg.org/badges/version/default)](https://cran.rstudio.com/web/packages/default)
[![cran downloads](http://cranlogs.r-pkg.org/badges/default)](http://cran.rstudio.com/web/packages/default/index.html)
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, cache = FALSE, fig.height=3, fig.width=4)
set.seed(1)
```
# default
### change the default arguments in R functions.
Tired of always typing out the same old arguments to functions? Use `default()` to set your favourite arguments as the defaults.
### Example:
```{r load, eval = FALSE}
install.packages("default")
library(default)
```
```{r load_secret, echo = FALSE}
library (default)
```
##### boring old defaults
```{r boring}
hist(iris$Sepal.Width)
```
##### exciting new defaults
```{r exciting}
default(hist.default) <- list(col = "deeppink", border = "white", ylab = "", main = "")
```
```{r exciting_plot}
hist(iris$Sepal.Width)
```
##### you can still change the arguments
```{r change}
hist(iris$Sepal.Width, col = "limegreen")
```
##### and restore the original defaults
```{r restore}
hist.default <- reset_default(hist.default)
hist(iris$Sepal.Width)
```