-
Notifications
You must be signed in to change notification settings - Fork 2
/
README.Rmd
165 lines (132 loc) · 6.54 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
<!-- README.md is generated from README.Rmd. Please edit that file
library(rmarkdown)
render('README.Rmd', output_format=html_vignette(css='vignettes/styles.css'))
rmarkdown::render('README.Rmd', output_format=rmarkdown::md_document())
-->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "##",
fig.path = "README-",
error = TRUE
)
library(vetr)
```
# vetr
[![R build status](https://github.com/brodieG/vetr/workflows/R-CMD-check/badge.svg)](https://github.com/brodieG/vetr/actions)
[![](https://codecov.io/github/brodieG/vetr/coverage.svg?branch=master)](https://app.codecov.io/gh/brodieG/vetr?branch=master)
[![](http://www.r-pkg.org/badges/version/vetr)](https://cran.r-project.org/package=vetr)
[![Project Status: WIP - Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip)
[![Dependencies direct/recursive](https://tinyverse.netlify.app/badge/vetr)]( https://tinyverse.netlify.app/)
```{r child='vignettes/rmdhunks/trust-but-verify.Rmd'}
```
```{r child='vignettes/rmdhunks/declarative-checks.Rmd'}
```
## Vetting Expressions
```{r child='vignettes/rmdhunks/vetting-expressions.Rmd'}
```
## `vetr` in Functions
If you are vetting function inputs, you can use the `vetr` function, which works
just like `vet` except that it is streamlined for use within functions:
```{r}
fun <- function(x, y) {
vetr(numeric(1L), logical(1L))
TRUE # do work...
}
fun(1:2, "foo")
fun(1, "foo")
```
`vetr` automatically matches the vetting expressions to the corresponding
arguments and fetches the argument values from the function environment.
See [vignette][4] for additional details on how the `vetr` function works.
## Additional Documentation
* [`vetr` vignette][1], `?vet`, `?vetr`, `example(vet)`, `example(vetr)`.
* [`alike` vignette][2], `?alike`, and `example(alike)` for discussion of
templates.
* A survey of [parameter validation functions][5].
## Development Status
`vetr` is still in development, although most of the features are considered
mature. The most likely area of change is the treatment of function and
language templates (e.g. `alike(sum, max)`), and more flexible treatment of
list templates (e.g. in future lists may be allowed to be different lengths so
long as every named element in the template exists in the object).
## Installation
This package is available on CRAN:
```{r eval=FALSE}
install.packages('vetr')
```
It has no runtime dependencies.
For the development version use
`remotes::install_github('brodieg/vetr@development')` or:
```{r eval=FALSE}
f.dl <- tempfile()
f.uz <- tempfile()
github.url <- 'https://github.com/brodieG/vetr/archive/development.zip'
download.file(github.url, f.dl)
unzip(f.dl, exdir=f.uz)
install.packages(file.path(f.uz, 'vetr-development'), repos=NULL, type='source')
unlink(c(f.dl, f.uz))
```
The master branch typically mirrors CRAN and should be stable.
## Alternatives
There are many alternatives available to `vetr`. We do a survey of the
following in our [parameter validation functions][5] review:
```{r child='vignettes/rmdhunks/related-packages.Rmd'}
```
## Acknowledgments
Thank you to:
* R Core for developing and maintaining such a wonderful language.
* CRAN maintainers, for patiently shepherding packages onto CRAN and maintaining
the repository, and Uwe Ligges in particular for maintaining
[Winbuilder](https://win-builder.r-project.org/).
* Users and others who have reported bugs and/or helped contribute fixes (see
NEWS.md).
* Tomas Kalibera for [rchk](https://github.com/kalibera/rchk) and rcnst to help
detect errors in compiled code, and in particular for his infinite patience in
helping me resolve the issues he identified for me.
* [Jim Hester](https://github.com/jimhester) because
[covr](https://cran.r-project.org/package=covr) rocks.
* [Dirk Eddelbuettel](https://github.com/eddelbuettel) and [Carl
Boettiger](https://github.com/cboettig) for the
[rocker](https://github.com/rocker-org/rocker) project, and [Gábor
Csárdi](https://github.com/gaborcsardi) and the
[R-consortium](https://www.r-consortium.org/) for
[Rhub](https://github.com/r-hub), without which testing bugs on R-devel and
other platforms would be a nightmare.
* [Winston Chang](https://github.com/wch) for the
[r-debug](https://hub.docker.com/r/wch1/r-debug/) docker container, in
particular because of the valgrind level 2 instrumented version of R.
* [Hadley Wickham](https://github.com/hadley/) and [Peter
Danenberg](https://github.com/klutometis) for
[roxygen2](https://cran.r-project.org/package=roxygen2).
* [Yihui Xie](https://github.com/yihui) for
[knitr](https://cran.r-project.org/package=knitr) and [J.J.
Allaire](https://github.com/jjallaire) etal for
[rmarkdown](https://cran.r-project.org/package=rmarkdown), and by extension
John MacFarlane for [pandoc](https://pandoc.org/).
* [Michel Lang](https://github.com/mllg) for pushing me to implement `all_bw` to
compete with his own package [`checkmate`](https://cran.r-project.org/package=checkmate).
* [Eugene Ha](https://github.com/egnha) for pointing me to several other
relevant packages, which in turn led to the [survey of related packages][5].
* Stefan M. Bache for the idea of having a function for testing objects directly
(originally `vetr` only worked with function arguments), which I took from
ensurer.
* Olaf Mersmann for
[microbenchmark](https://cran.r-project.org/package=microbenchmark), because
microsecond matter, and [Joshua Ulrich](https://github.com/joshuaulrich) for
making it lightweight.
* All open source developers out there that make their work freely available
for others to use.
* [Github](https://github.com/), [Codecov](https://about.codecov.io/),
[Vagrant](https://www.vagrantup.com/), [Docker](https://www.docker.com/),
[Ubuntu](https://ubuntu.com/), [Brew](https://brew.sh/) for providing
infrastructure that greatly simplifies open source development.
* [Free Software Foundation](https://www.fsf.org/) for developing the GPL
license and promotion of the free software movement.
## About the Author
Brodie Gaslam is a hobbyist programmer based on the US East Coast.
[1]: https://cran.r-project.org/package=vetr/vignettes/vetr.html
[2]: https://cran.r-project.org/package=vetr/vignettes/alike.html
[3]: https://cran.r-project.org/package=vetr/vignettes/vetr.html#non-standard-evaluation
[4]: https://cran.r-project.org/package=vetr/vignettes/vetr.html#in-functions
[5]: http://htmlpreview.github.io/?https://github.com/brodieG/vetr/blob/master/extra/compare.html