It’s not only possible, but very easy:
DF[rowSums(DF == 0) <= 4, ]
You could also use apply
:
DF[apply(DF == 0, 1, sum) <= 4, ]
More Related Contents:
- How to sum a variable by group
- How do I make a list of data frames?
- Split data frame string column into multiple columns
- How to convert a data frame column to numeric type?
- Filtering a data frame by values in a column [duplicate]
- subtract value from previous row by group
- Repeat rows of a data.frame [duplicate]
- Expand ranges defined by “from” and “to” columns
- Adding a column of means by group to original data [duplicate]
- pair-wise duplicate removal from dataframe [duplicate]
- Transpose a data frame
- Combine two or more columns in a dataframe into a new column with a new name
- Error – replacement has [x] rows, data has [y]
- How to swap values between two columns
- Define and apply custom bins on a dataframe
- Subset of rows containing NA (missing) values in a chosen column of a data frame
- rbind dataframes with a different column name
- Find duplicated rows (based on 2 columns) in Data Frame in R
- Converting two columns of a data frame to a named vector
- Collapsing data frame by selecting one row per group
- Change value of variable with dplyr
- How to initialize empty data frame (lot of columns at the same time) in R
- Practical limits of R data frame
- R: Assign variable labels of data frame columns
- rbind data frames based on a common pattern in data frame name
- Merge or combine by rownames
- How to add new column to an dataframe (to the front not end)?
- Return pmin or pmax of data.frame with multiple columns
- How to divide a number of columns by one column?
- Split a column by group [duplicate]