knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(relper)
is_
functions returns a boolean, given a condition.
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)
The goal of is_date
is to check if a value is a date.
is_date(Sys.time()) is_date(Sys.Date())
The goal of is_datetime
is to check if a value is a datetime.
is_datetime(Sys.time()) is_datetime(Sys.Date())
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)
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)
The goal of is_negative
is to check if a value is negative.
is_negative(1) is_negative(-1)
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)
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)
The goal of is_positive
is to check if a value is positive.
is_positive(1) is_positive(-1)
The goal of is_string
is to check if a value is a string, character or factor.
is_string("A") is_string(factor("A"))
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())
The goal of is_zero
is to check if a value is equal to zero.
is_zero(1) is_zero(0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.