in_subset {inops} | R Documentation |
Subsetting Values and Intervals
Description
Operators for subsetting values within a given interval or set.
Usage
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
# 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
[Package inops version 0.0.1 Index]