```
# NOT RUN {
x <- as.big.matrix(matrix(1:30, 10, 3))
options(bigmemory.allow.dimnames=TRUE)
colnames(x) <- c("A", "B", "C")
x[,]
x[mwhich(x, 1:2, list(c(2,3), c(11,17)),
list(c('ge','le'), c('gt', 'lt')), 'OR'),]
x[mwhich(x, c("A","B"), list(c(2,3), c(11,17)),
list(c('ge','le'), c('gt', 'lt')), 'AND'),]
# These should produce the same answer with a regular matrix:
y <- matrix(1:30, 10, 3)
y[mwhich(y, 1:2, list(c(2,3), c(11,17)),
list(c('ge','le'), c('gt', 'lt')), 'OR'),]
y[mwhich(y, -3, list(c(2,3), c(11,17)),
list(c('ge','le'), c('gt', 'lt')), 'AND'),]
x[1,1] <- NA
mwhich(x, 1:2, NA, 'eq', 'OR')
mwhich(x, 1:2, NA, 'neq', 'AND')
# Column 1 equal to 4 and/or column 2 less than or equal to 16:
mwhich(x, 1:2, list(4, 16), list('eq', 'le'), 'OR')
mwhich(x, 1:2, list(4, 16), list('eq', 'le'), 'AND')
# Column 2 less than or equal to 15:
mwhich(x, 2, 15, 'le')
# No NAs in either column, and column 2 strictly less than 15:
mwhich(x, c(1:2,2), list(NA, NA, 15), list('neq', 'neq', 'lt'), 'AND')
x <- big.matrix(4, 2, init=1, type="double")
x[1,1] <- Inf
mwhich(x, 1, Inf, 'eq')
mwhich(x, 1, 1, 'gt')
mwhich(x, 1, 1, 'le')
# }
```

Run the code above in your browser using DataCamp Workspace