9 lines
227 B
R
9 lines
227 B
R
|
|
#' @title Find indices and values of nonzero elements
|
||
|
|
#' @description Emulates behavior of `find`
|
||
|
|
find <- function(x) {
|
||
|
|
if (is.logical(x)) {
|
||
|
|
return(which(x))
|
||
|
|
} else {
|
||
|
|
return(which(x > 0))
|
||
|
|
}
|
||
|
|
}
|