[英]How to remove rows from a data frame when the column matches with a different data frame column in R
I have a data frame A of the below format Word Freq p 9531 can 2085 /p 2055 get 1183 use 1112
我有以下格式的数据帧A Word Freq p 9531 can 2085 /p 2055 get 1183 use 1112
and another data frame B 和另一个数据框B
Word Freq p 10 can 2 /p 55
Now I want to remove the rows from data frame A that has a matching in the data frame B. So my output would be for data frame A 现在,我想从数据帧A中删除与数据帧B中具有匹配项的行。因此,我的输出将是数据帧A的
Word Freq get 1183 use 1112
Do it this way: 这样做:
A<-read.table(text="Word Freq
p 9531
can 2085
/p 2055
get 1183
use 1112",header=T)
B<-read.table(text="Word Freq
p 10
can 2
/p 55",header=T)
A[-which(A$Word %in% B$Word),]
result: 结果:
Word Freq
4 get 1183
5 use 1112
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.