I want to eliminate the continuous values in a data table. What I want is to remove all rows of every variable if there are more than 2 zeros in the column. Here is an example:
library(data.table)
dt <- data.table(a = c(1, 2, 1, 0, 0, 0, 0, 1, 2),
b = as.factor(c("x", "y", "x", "x", "y", "z", "x", "y", "y")),
c = c(2, 5, 1, 0, 3, 6, 0, 3, 4))
dtRes <- data.table(a = c(1, 2, 1, 1, 2),
b = as.factor(c("x", "y", "x", "y", "y")),
c = c(2, 5, 1, 3, 4))