R/rm_0s_by_row.R

Defines functions rm_0s_by_row

Documented in rm_0s_by_row

#' removes zeros from matricies by row
#'
#' @param r matrix
#'
#' @return remaining rows with values, matrix
#' @export
#'
#' @examples
#' set.seed(123)
#' x = matrix(rpois(100, .1), 10, 10)
#' rm_0s_by_row(x)
rm_0s_by_row<- function(r){
  output<-r[-rowSums(r) == 0, ]
  return(output)
}
Deebee33/N0 documentation built on Dec. 17, 2021, 4:11 p.m.