Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brodieg/vetr
Trust, but Verify
https://github.com/brodieg/vetr
argument-checks input-validation r
Last synced: 11 days ago
JSON representation
Trust, but Verify
- Host: GitHub
- URL: https://github.com/brodieg/vetr
- Owner: brodieG
- Created: 2014-12-06T01:43:47.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2023-12-06T00:55:48.000Z (11 months ago)
- Last Synced: 2024-03-15T03:08:52.582Z (8 months ago)
- Topics: argument-checks, input-validation, r
- Language: C
- Homepage:
- Size: 6.58 MB
- Stars: 76
- Watchers: 5
- Forks: 2
- Open Issues: 38
-
Metadata Files:
- Readme: README.Rmd
- Contributing: CONTRIBUTING.md
Awesome Lists containing this project
README
```{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