can some help me how to do this in R Programming?
Pl check the link i have same kind of situation
Check if value from one dataframe exists in another dataframe
can some help me how to do this in R Programming?
Pl check the link i have same kind of situation
Check if value from one dataframe exists in another dataframe
Using the same data and outcome as the original Python example
Df1 <- data.frame(name = c('Marc', 'Jake', 'Sam', 'Brad'))
Df2 <- data.frame(IDs = c('Jake', 'John', 'Marc', 'Tony', 'Bob'))
Df1$presentinDf2 <- as.integer(Df1$name %in% Df2$IDs)
Df1
#> name presentinDf2
#> 1 Marc 1
#> 2 Jake 1
#> 3 Sam 0
#> 4 Brad 0
I'm not sure if this is what you're looking for, but you can use anti_join from the dplyr package to create a new dataframe with the duplicate information between the datasets.
df1 <- data.frame(name = c('Marc', 'Jake', 'Sam', 'Brad'))
df2 <- data.frame(name = c('Jake', 'John', 'Marc', 'Tony', 'Bob'))
diff <- anti_join(df2, df1, by = "name")
> diff
name
1 John
2 Tony
3 Bob