Added basic translation of "find"

This commit is contained in:
Waldir Leoncio 2020-03-18 10:30:37 +01:00
parent ac05f90b87
commit 42ada1d34a
3 changed files with 28 additions and 0 deletions

9
R/find.R Normal file
View 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))
}
}