in_subset: Subsetting Values and Intervals

Description Usage Arguments Details Value See Also Examples

Description

Operators for subsetting values within a given interval or set.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
x %[in{}% table

x %[out{}% table

x %[in[]% interval

x %[out[]% interval

x %[in()% interval

x %[out()% interval

x %[in(]% interval

x %[out(]% interval

x %[in[)% interval

x %[out[)% interval

x %[in~% pattern

x %[out~% pattern

x %[in~p% pattern

x %[out~p% pattern

x %[in~f% pattern

x %[out~f% pattern

x %[in% table

x %[out% table

x %[in#% count

x %[out#% count

Arguments

x

vector or array of values to be matched.

table

vector or list to be matched against.

interval

numeric vector defining a range to be matched against.

pattern

pattern to be matched against.

count

numeric vector defining counts for count-based selection.

Details

For each %[*% operator of this package x %[*% y is a shorthand for x[x %*% y].

Value

elements of x matched by the used infix operator type.

See Also

%in{}%

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# interval subsetting operators
x <- 1:10
x %[in[]% c(3,7)
x %[in[)% c(3,7)
x %[out[)% c(3,7)

# regular expression subsetting operators
carnames <- rownames(mtcars)
carnames %[in~% "^Mazda"
carnames %[in~% c("^Mazda", "^Merc")
carnames %[in~% c("\\w{10,100}$")  # long car names

# count-based subsetting operators
mtcars$cyl %[in#% 1:10
mtcars$cyl %[out#% 1:10

inops documentation built on Nov. 19, 2019, 5:08 p.m.