Added basic translation of "find"
This commit is contained in:
parent
ac05f90b87
commit
42ada1d34a
3 changed files with 28 additions and 0 deletions
9
R/find.R
Normal file
9
R/find.R
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#' @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))
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue