knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "##",
  fig.path = "README-",
  error = TRUE
)
library(vetr)

vetr

R build status Project Status: WIP - Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. Dependencies direct/recursive



Vetting Expressions


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:

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 for additional details on how the vetr function works.

Additional Documentation

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:

install.packages('vetr')

It has no runtime dependencies.

For the development version use remotes::install_github('brodieg/vetr@development') or:

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 review:


Acknowledgments

Thank you to:

About the Author

Brodie Gaslam is a hobbyist programmer based on the US East Coast.



brodieG/validate documentation built on Feb. 2, 2023, 10:43 a.m.