mat <- matrix(c(0,0,0, 1,1,0, 0,0,NA), ncol = 3, byrow = TRUE)
mat
#> [,1] [,2] [,3]
#> [1,] 0 0 0
#> [2,] 1 1 0
#> [3,] 0 0 NA
drop_empty_rows(mat)
#> [,1] [,2] [,3]
#> [1,] 1 1 0
drop_empty_rows(mat, na.rm = FALSE)
#> [,1] [,2] [,3]
#> [1,] 1 1 0
#> [2,] 0 0 NA