1

segs2我在两个数据对象(和)中有两个文件和以下列(下面给出的是列名tn)。

names(cbind(segs2[,2:6]))
[1] "chrom"     "loc.start" "loc.end"   "num.mark"  "seg.mean" 

names(cbind(tn[,4:10]))
[1] "num_positions"      "normal_depth"       "tumor_depth"        "adjusted_log_ratio"
[5] "gc_content"         "region_call"        "raw_ratio"  

names(cbind(tn[,1:10]))
 [1] "chrom"              "chr_start"          "chr_stop"           "num_positions"     
 [5] "normal_depth"       "tumor_depth"        "adjusted_log_ratio" "gc_content"        
 [9] "region_call"        "raw_ratio"         

我尝试按染色体合并,开始和停止位置在两个文件中都很常见,但标题名称不同(合适的脚本将有助于自动分析许多文件);

filenum <- cbind(segs2[,2:6], tn[,1:10], by=c("chrom","loc.start","loc.end","chr_start","chr_stop"))

data.frame(..., check.names = FALSE) 中的错误:参数暗示不同的行数:1146、829244、5

file_num <- cbind(segs2[,2:6], tn[,1:10], by=c("chrom","loc.start","loc.end","chrom","chr_start","chr_stop"), check.names=TRUE)

但是这没有用,有替代方法吗?

谢谢

乌玛

4

1 回答 1

3

正如 mplourde 所提到的,我认为你想要的是:

merge(segs2, tn, 
      by.x=c("chrom", "loc.start", "loc.end"),
      by.y=c("chrom", "chr_start", "chr_stop"))

如果名称不同,您可以使用by.xandby.y指定应匹配哪些列。

于 2012-09-25T19:30:21.620 回答