knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(relper)

is_ functions returns a boolean, given a condition.

is_blank

The goal of is_blank is to check if a value is blank.

is_blank("")

is_blank(NA_character_)

is_blank(" ")

is_blank("-")

is_blank(NULL)

is_blank(NaN)

is_date

The goal of is_date is to check if a value is a date.

is_date(Sys.time())

is_date(Sys.Date())

is_datetime

The goal of is_datetime is to check if a value is a datetime.

is_datetime(Sys.time())

is_datetime(Sys.Date())

is_even

The goal of is_even is to check if a value is even.

is_even(1)

is_even(2)

is_even(1.1)

is_even(2.2)

is_integer

The goal of is_integer is to check if a value is a integer, not considering their variable type but the value.

is_integer(1.1)

is_integer(1)

is_negative

The goal of is_negative is to check if a value is negative.

is_negative(1)

is_negative(-1)

is_odd

The goal of is_odd is to check if a value is odd.

is_odd(1)

is_odd(2)

is_odd(1.1)

is_odd(2.2)

is_outlier

The goal of is_outlier is to check if a value is an outlier, by using the boxplot outlier criteria, given by:

$$ [x < (Q_1 - 1.5 * IQR)] \quad | \quad [x > (Q_3 - 1.5 * IQR)],$$

where:

x <- c(1,2,3,5,7,8,12,100)

is_outlier(x)

is_positive

The goal of is_positive is to check if a value is positive.

is_positive(1)

is_positive(-1)

is_string

The goal of is_string is to check if a value is a string, character or factor.

is_string("A")

is_string(factor("A"))

is_weekend

The goal of is_weekend is to check if a date variable is in a weekend (saturday/sunday).

is_weekend(Sys.time())

is_weekend(Sys.Date())

is_zero

The goal of is_zero is to check if a value is equal to zero.

is_zero(1)

is_zero(0)


vbfelix/relper documentation built on May 10, 2024, 10:50 p.m.