| detect {arkhe} | R Documentation |
Find Rows/Columns Using a Predicate
Description
Finds rows/columns in an array-like object using a predicate function.
Usage
detect(x, ...)
## S4 method for signature 'ANY'
detect(x, f, margin = 1, negate = FALSE, all = FALSE, na.rm = FALSE, ...)
Arguments
x |
An R object (should be a |
... |
Further arguments to be passed to |
f |
A predicate |
margin |
A length-one |
negate |
A |
all |
A |
na.rm |
A |
Value
A logical vector.
Author(s)
N. Frerebeau
See Also
Other data preparation tools:
append(),
assign(),
compact(),
count(),
discard(),
get(),
keep(),
seek()
Examples
## Create a data matrix
X <- matrix(sample(1:10, 25, TRUE), nrow = 5, ncol = 5)
## Add NA
k <- sample(1:25, 3, FALSE)
X[k] <- NA
X
## Find row with NA
detect(X, f = is.na, margin = 1)
## Find column without any NA
detect(X, f = is.na, margin = 2, negate = TRUE, all = TRUE)