我有两个数据框
A ### data frame contain GO ids
GOBPID
G0:00987
GO:06723
GO:02671
GO:00654
GO:00132
B ### containing GO ids with their associated columns
GOBPID term
GO:08765 flavonoid synthesis
G0:00133 biosynthesis process
G0:00987 carotenoid synthesis
GO:06723 coumarin synthesis
GO:00824 metabolic process
GO:02671 leaf morphology
GO:00654 response to light
GO:00268 response to stress
GO:00135 pathogen defense
GO:00132 spindle formation
我只想从 A 和 B 中提取公共 id 并删除其余的行
#from A # from B # from B
G0:00987 G0:00987 carotenoid synthesis
GO:06723 GO:06723 coumarin synthesis
GO:02671 GO:02671 leaf morphology
GO:00654 GO:00654 response to light
GO:00132 GO:00132 spindle formation
并做了以下事情:
list of terms<- merge(A,B,by.x="GOBPID",by.y="GOBPID")
但是出现了一个错误并返回了一个长度为 0 的数据框,其中只有列名但没有合并。
[1] GOBPID Term
<0 rows> (or 0-length row.names)
并再次尝试以下
merge(A,B,by.x="row.names",by.y="row.names")
它只是合并了两个数据框,但没有给我常见的 id。来自 A 的 5 个 id 只是匹配到 B 中的前 5 个 id,并且不考虑仅合并公共 id。
我也添加了两个数据集:
[dataset A][http://public.justcloud.com/dldzm0fnsp.4540049]
[dataset B][http://public.justcloud.com/dldzmx1758.4540049]