assert_cols_in: Asserts That Columns are in Data Frame

Description Usage Arguments Details Examples

View source: R/assert_cols_in.R

Description

Asserts That Columns are in Data Frame

Usage

1
assert_cols_in(d, cols, ...)

Arguments

d

data.frame

cols

character vector of columns to check for

...

name of columns to check for

Details

Column names can be provided either as a character vector (in parameter cols) or as the names of columns to check for (without quotations). Do not mix the types.

Examples

1
2
3
4
5
6
7
8
assert_cols_in(iris, c("Petal.Width", "Petal.Length")) # cols in, will do nothing
assert_cols_in(iris, Petal.Width, Petal.Length)

## Not run: 
assert_cols_in(iris, c("x", "y")) # cols not in, will assert error
assert_cols_in(iris, x, y)

## End(Not run)

jennguyen1/scriptR documentation built on May 29, 2019, 1:05 a.m.