I have data which I list with the function, lapply
:
For example:
library(data.table)
# example data
data <- data.frame(D = rep(c("111"), 8),
I = c(rep("2012", 5), "2014", "2013", "2013"),
S = rep(c("1000", "2000"), 4))
list=lapply(X=colnames(data),FUN=function(X) setDT(data)[, .(Anzahl = .N), by = X][order(-Anzahl),])
Now I want to delete all list entries which have just 1 row: Here just the first one but it can be much more.
Alternatively I can remove all the columns which have just one factor (In Example D, because they are all the same).