在不同的数据表中查找重叠
Find overlaps in different datatables
我有大约 30 条数据table。现在我想在某些 table 的第一列中找到重叠部分并提取它们。结果应该是 table,第一列中的重叠来自两个以上的数据table。这是一个例子:
表 1:
Gen Estimate Std. Error p-Wert
1007_s_at -0.159699 0.07834 0.04265
1053_at -0.174647 0.064535 0.0098976
121_at 0.1765678 0.05116854 0.0000657
表 2:
Gen Estimate Std. Error p-Wert
1494_f_at 0.2222467 0.0553653 0.0075838
121_at 0.873683 0.00898737 0.0088378
1316_at 0.098764 0.098456 0.048899
1007_s_at 0.89723 0.5675389 0.00007865
表 3:
Gen Estimate Std.Error p-Wert
1007_s_at 0.0864567 0.8931278 0.005542
121_at 0.2378590 0.0236586 0.00005667
1494_f_at 0.4597023 0.9875357 0.0091234
结果应该是:
Gen
1007_s_at
121_at
我尝试了 foverlaps 函数,但那只适用于两个数据table。所以它没有用。
我希望有人能提供帮助。
谢谢!
我想为此你想使用集合操作。
这应该有效:
dat1 <- data.frame(gen = c("aaaaa", "1494_f_at", "1111", "!!!!"), stringsAsFactors = FALSE)
dat2 <- data.frame(gen = c("1494_f_at", "cccccc", "!!!!","999"), stringsAsFactors = FALSE)
dat3 <- data.frame(gen = c( "!!!!","1494_f_at", "999", "dddddd"), stringsAsFactors = FALSE)
intersect(intersect(dat1[,1], dat2[,1]), dat3[,1])
我有大约 30 条数据table。现在我想在某些 table 的第一列中找到重叠部分并提取它们。结果应该是 table,第一列中的重叠来自两个以上的数据table。这是一个例子:
表 1:
Gen Estimate Std. Error p-Wert
1007_s_at -0.159699 0.07834 0.04265
1053_at -0.174647 0.064535 0.0098976
121_at 0.1765678 0.05116854 0.0000657
表 2:
Gen Estimate Std. Error p-Wert
1494_f_at 0.2222467 0.0553653 0.0075838
121_at 0.873683 0.00898737 0.0088378
1316_at 0.098764 0.098456 0.048899
1007_s_at 0.89723 0.5675389 0.00007865
表 3:
Gen Estimate Std.Error p-Wert
1007_s_at 0.0864567 0.8931278 0.005542
121_at 0.2378590 0.0236586 0.00005667
1494_f_at 0.4597023 0.9875357 0.0091234
结果应该是:
Gen
1007_s_at
121_at
我尝试了 foverlaps 函数,但那只适用于两个数据table。所以它没有用。
我希望有人能提供帮助。 谢谢!
我想为此你想使用集合操作。
这应该有效:
dat1 <- data.frame(gen = c("aaaaa", "1494_f_at", "1111", "!!!!"), stringsAsFactors = FALSE)
dat2 <- data.frame(gen = c("1494_f_at", "cccccc", "!!!!","999"), stringsAsFactors = FALSE)
dat3 <- data.frame(gen = c( "!!!!","1494_f_at", "999", "dddddd"), stringsAsFactors = FALSE)
intersect(intersect(dat1[,1], dat2[,1]), dat3[,1])