Removing columns containing only zeros

rm_zero_cols(X)

Arguments

X

A matrix or data frame

Value

A matrix or data frame

Examples


X <- matrix(c(1, 0, 3, 0, 5, 0, 0, 0), nrow = 2)
print(misc::rm_zero_cols(X))
#>      [,1] [,2] [,3]
#> [1,]    1    3    5
#> [2,]    0    0    0