'Subset based on one value in multiple columns

I have a dataset with weekly number of lucky days for some of those weekly values i have values greater than 7 which must be a mistake.

Therefore what I want to do is to delete rows which have a value greater than 7 in one of the multiple columns. Those columns are column 21 to 68. What I have tried so far is this:

new_df <- subset(df, 21:68 <= 7) 

This leaves me with an completely empty new_df.

I know there is a option that goes like this:

new_df <- subset(df, b != 7 & d != 7)

But I feel like there must be a more elegant way than to name every single column which I want to refer to. Do I need to use square brackets or sth. like that? There is no Error message when computing the above mentioned command. The referred values are numerical.

Can someone help?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source