R/position_finder.R

Defines functions position_finder

Documented in position_finder

#' Find the index of the first nonzero value in a vector
#' 
#' @param vec A binary vector
#' @return Position of the first nonzero value in a vector.

position_finder <- function(vec) {
  if(length(which(vec == 1)) != 0) {
    return(min(which(vec == 1)))
  } else {
    return(999999)
  }
}

Try the biclustermd package in your browser

Any scripts or data that you put into this service are public.

biclustermd documentation built on June 17, 2021, 5:11 p.m.