ourMELONS/R/find.R
2020-03-18 15:02:38 +01:00

10 lines
No EOL
278 B
R

#' @title Find indices and values of nonzero elements
#' @description Emulates behavior of `find`
#' @param x object or logic operation on an object
find <- function(x) {
if (is.logical(x)) {
return(which(x))
} else {
return(which(x > 0))
}
}