I'm trying to delete a row of my data table based on the values of two columns, but with no luck.
I tried two codes that I found in other threads:
my.data.table[!(my.data.table[,1]==6557 & my.data.table[,2]=="31-Dec-82"),]
###var1 is in column 1 and var2 is in column 2
my.data.table %>% filter(var1!= 6557 & var2!="31-Dec-82")
but none works. Note that var1
is numeric and var2
is character (not date for now).
The only approach I could make work is by looking up the row number manually
my.data.table<-my.data.table[-rownumber]
but this is not very convenient in a 1M row table, even if sorted.
Any idea why I cannot make it work?