unlike: Negation of %like% Operator

Description Usage Arguments Value Examples

Description

R (data.table) lacks a negation of the %like% operator. While you can negate the whole expression, that solution results in less readable and clear code.

Usage

1
2
3
4
5
unlike(.vector, .pattern)

.vector %unlike% .pattern

.vector %notlike% .pattern

Arguments

.vector

Either a character vector or a factor.

.pattern

Gets passed on to pattern in grepl.

Value

Logical vector of same length as .vector. TRUE if the input value matches the pattern (via regular expression matching). FALSE otherwise.

Examples

1
"ana" %like% c("Anabelle", "banana", "BanAna", "meh")

STAT-UP/statupinternal documentation built on May 9, 2019, 11:43 a.m.