Skip to content
Advertisement

R: How to use “NOT IN” logic in R

How can I convert below sql query to R Logic:

SELECT * FROM FRUITS WHERE (ID||TYPE||DATE) NOT IN (SELECT (ID||TYPE||DATE) FROM SEASONAL_FRUITS)

Advertisement

Answer

WIth tidyverse, it would be anti join

library(dplyr)
anti_join(FRUITS, SEASONAL_FRUITS, by = c("ID", "TYPE", "DATE"))        
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement