I have a list of dataframes containing only boolean (TRUE / FALSE) columns.
I need to know if any of these columns contains any TRUE value (all are expected to be false and in fact, all are FALSE), but I'm getting just nonsense.
mylist <-
list(df1=data.frame(
"column11" = c(FALSE, FALSE, FALSE, FALSE),
"column12" = c(FALSE, FALSE, FALSE, FALSE)
),df2=data.frame(
"column21" = c(FALSE, FALSE, FALSE, FALSE),
"column22" = c(FALSE, FALSE, FALSE, FALSE)
),df3=data.frame(
"column31" = c(FALSE, FALSE, FALSE, FALSE),
"column32" = c(FALSE, FALSE, FALSE, TRUE)
))
lapply(mylist, function(x) any(TRUE))
$df1
[1] TRUE
$df2
[1] TRUE
$df3
[1] TRUE