I am trying to drop all rows from my dataset for which the sum of rows over multiple columns equals a certain number.
It looks something like this:
a <- c(1,1,1,1,1,1)
b <- c(1,1,1,1,1,1)
e <- c(0,1,1,1,1,1)
d <- data.frame(a,b,e)
d_subset <- d[!rowSums(d[,2:3], na.rm=T) == 1]
So d_subset should contain all rows where the sum of column 2 and 3 does not equal 1. Essentially, in this example, the first row should be dropped. However, this is not working and I am not sure why.