Remove rows with minimum count sum

With tidyverse,

library(dplyr)
df %>% filter(rowSums(.[1:3]) >= 10)
  a b c
1 3 4 5
2 1 8 1

Or, with your code in base,

keep <- rowSums(df[,1:3]) >= 10
df <- df[keep,]

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top