operators: Operators

operatorsR Documentation

Operators

Description

Extensions of base operators.

inverse of %in%

Usage

x %notin% vector

x %allin% vector

x %anyin% vector

x %nonein% vector

pattern %partin% vector

Arguments

x

Numeric or character vector.

vector

Numeric or character vector.

pattern

Character string containing regular expressions to be matched.

Value

logical

logical

See Also

base::any(), base::match(), and base::all()

base::grepl()

Examples

data <- data.frame(
  id = 1:10,
  x = as.integer(runif(10, 0, 10))
)

data[data$id %notin% c(1, 3, 5, 7, 9), ]

1:2 %allin% 1:3  # TRUE
3:4 %allin% 1:3  # FALSE
3:4 %anyin% 1:3  # TRUE
4:5 %anyin% 1:3  # FALSE
3:4 %nonein% 1:3  # FALSE
4:5 %nonein% 1:3  # TRUE
"Bei" %partin% c("Beijing", "Shanghai")  # TRUE
"bei" %partin% c("Beijing", "Shanghai")  # FALSE
"[aeiou]ng" %partin% c("Beijing", "Shanghai")  # TRUE


jimbrig2011/jimstools documentation built on Sept. 14, 2022, 1:38 a.m.