Suppose i have data
mydat=structure(list(id = 1:6, x2 = c(12L, 12L, 12L, 12L, 12L, 12L),
x3 = c(12L, 12L, 12L, 12L, 12L, 12L)), .Names = c("id", "x2",
"x3"), class = "data.frame", row.names = c(NA, -6L))
Also i have file csv
test=read.csv(path,sep=";", dec",")
it has this stucture
test=structure(list(id = 1:5, x2 = c(12L, 12L, 12L, 12L, 12L), x3 = c(12L,
12L, 12L, 12L, 12L)), .Names = c("id", "x2", "x3"), class = "data.frame", row.names = c(NA,
-5L))
How can i match these 2 datasets in such way that from mydat
were removed
observations which have similar id with test
?
I.E. output must be
id x2 x3
6 12 12
cause id 1,2,3,4,5
in mydat
is similar with test
dataset.
Using R base.
You can use
anti_join
from dplyr`In base R: you can collapse down the data into strings and compare them: