when would you do this:
- !(dataframe$columnA == 222 & dataframe$columnB == 1234)
vs.
- (dataframe$columnA != 222 & dataframe$columnB !=1234)
when would you do this:
vs.
dataframe <- data.frame(columnA=c(222,222,111,111), columnB=c(1234,9999,1234,9999))
dataframe
#> columnA columnB
#> 1 222 1234
#> 2 222 9999
#> 3 111 1234
#> 4 111 9999
# this one gives all rows that are not row 1
!(dataframe$columnA == 222 & dataframe$columnB == 1234)
#> [1] FALSE TRUE TRUE TRUE
# this one gives the intersection of rows 3-4 and rows 2,4
(dataframe$columnA != 222 & dataframe$columnB !=1234)
#> [1] FALSE FALSE FALSE TRUE
Created on 2019-06-11 by the reprex package (v0.3.0)
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.