Q:

Remove a Row by different values

Here is an example of a DF:
v1<-c(1,1,1,1,2,2,2,2,3,3,3,3)
v2<-c(234,457,234,675,235,205,347,578,695,783,200,697)
v3<-c(528,659,102,236,358,562,987,102,235,474,888,362)
df<- data.frame(v1,v2,v3)

For this example my intention is to remove the row with the v1=1, v2=457 and v3=659.
I'm trying different ways (subset or even []), for example:
subset(df,df$v1!=1 & df$v2!=457 & df$v3!=659)
df[df$v1!=1 & df$v2!=457 & df$v3!=659,]

However in both cases all rows with v1=1 are removed. How should I write this in order that just the row with v1=1, v2=457 and v3=659 is removed?
So the final DF should be like this:
v1<-c(1,1,1,2,2,2,2,3,3,3,3)
v2<-c(234,234,675,235,205,347,578,695,783,200,697)
v3<-c(528,102,236,358,562,987,102,235,474,888,362)
df<- data.frame(v1,v2,v3)

A:

This seems to be correct logic
df[!(df$v1 == 1 & df$v2 == 457 & df$v3 == 659),]

What you are doing is removing all rows where v1!= 1 and v2!=457 and v3!=659
> v1<-c(1,1,1,1,2,2,2,2,3,3,3,3)
> v2<-c(234,457,234,675,235,205,347,578,695,783,200,697)
> v3<-c(528,659,102,236,358,562,987,102,235,474,888,362)
> df<- data.frame(v1,v2,v3)

> df
   v1  v2  v3
1   1 234 528
2   1 457 659
3   1 234 102
4   1 675 236
5   2 235 358
6   2 205 562
7   2 347 987
8   2 578 102
9   3 695 235
10  3 783 474
11  3 200 888
12  3 697 362

> df[!(df$v1 == 1 & df$v2 == 457 & df$v3 == 659),]
   v1  v2  v3
1   1 234 528
3   1 234 102
4   1 675 236
5   2 235 358
6   2 205 562
7   2 347 987
8   2 578 102
9   3 695 235
10  3 783 474
11  3 200 888
12  3 697 362

A:

Close the conditions inside a bracket preceded by exclamation mark:
subset(df, !(df[,1] == 1 & df[,2] == 457 & df[,3] == 659))

