vc_compare: Validates If Comparison Met

View source: R/vc_compare.R

vc_compareR Documentation

Validates If Comparison Met

Description

Validates If Comparison Met

Usage

vc_compare(data, x, y, comparison, date = FALSE, ...)

Arguments

data

A data frame.

x

Column name from data (character string).

y

Column name from data (character string) to be compared to.

comparison

logical operator for the comparison

date

logical. If TRUE x and y are converted to dates via parsedate::parse_iso_8601.

...

ignored.

Examples

dat <- data.frame(
    a = c(NA, 1:10),
    b = c(0, 1, 2:10+1),
    d1 = c(NA, sprintf("2016-01-%sT09", 11:20)),
    d2 = c("2016-01-01T09", "2016-01-11T09", sprintf("2016-05-%sT09", 12:20)),
    stringsAsFactors = FALSE
)

vc_compare(dat, x = 'a', y = 'b', '<')
vc_compare(dat, x = 'a', y = 'b', '<=')
vc_compare(dat, x = 'd1', y = 'd2', '<', date=TRUE)
vc_compare(dat, x = 'd1', y = 'd2', '<=', date=TRUE)

steventsimpson/valiData documentation built on Jan. 27, 2023, 2:11 p.m.