I want to Identify the rows present in dataframe1 which are not present in dataframe2 based on a particular column. I have used the below code to get the desired information.
diffId <- anti_join(dat$ID,datwe$ID)
Unfortunately, I have encountered with an error:
Error in UseMethod("anti_join") :
no applicable method for 'anti_join' applied to an object of class "factor"
I have checked the class of the desired column in both the dataframes and which turned out to be factor
. Have also tried to separate the column into a separate variable in an assumption that it might solve the issue, but of no luck !
fac1 <- datwe$ID
fac2 <- dat$ID
diffId <- anti_join(fac2,fac1)
Could you please share your thoughts ?
Thanks