I want to remove data from a dataframe that is present in another dataframe. Let me give an example:
letters<-c(\'a\',\'b\',\'c\',\'d\',\'e\')
numbers<-c(1
Base R Solution
list_one[!list_one$letters %in% list_two$letters2,]
gives you:
letters numbers
2 b 2
5 e 5
Explanation:
> list_one$letters %in% list_two$letters2
[1] TRUE FALSE TRUE TRUE FALSE
This gives you a vector of LENGTH == length(list_one$letters)
with TRUE/FALSE Values. !
negates this vector. So you end up with FALSE/TRUE values if the value is present in list_two$letters2.
If you have questions about how to select rows from a data.frame enter
?`[.data.frame`
to the console and read it.