r语言 - 使用Dplyr Filter从另一个数据帧过滤行



我正在尝试使用Dplyr::Filter函数。我有一个数据框(top20_res)与20个基因名称的列表。我有第二个df ' gathered_group1_norm ',它有几个列,其中一个列是基因名称。我希望过滤' gatherred_group_1_norm ',但在' top20_res '中发现的20个geness,这样我最终得到一个包含这些基因和其他列数据的新数据框架。我想命令应该是:

df <- gathered_group1_norm %>% dplyr::filter(top20_res %in% gathered_group1_norm$ext_gene)

这似乎产生了一个df与列,但没有实际的数据在它?

我们可以做一个join

library(dplyr)
inner_join(gathered_group1_norm, top20_res, by = c("ext_gene" = "gene_name"))

相关内容

最新更新