R keep rows with at least one column greater than value

You can use rowSums to construct the condition in base R:

df[rowSums(df > 10) >= 1, ]

with dplyr (0.7.0), now you can use filter_all like this:

library(dplyr)
filter_all(df, any_vars(. > 10))

Leave a Comment