Comparing multiple columns in different data sets to find values within range R

前端 未结 1 432
一整个雨季
一整个雨季 2020-12-22 05:45

I have two datasets. One called domain (d) which as general information about a gene and table called mutation (m). Both tables have similar column called Gene.name, which I

相关标签:
1条回答
  • 2020-12-22 06:08

    A merge and subset should get you there (though I think your intended result doesn't match your description of what you want):

    result <- merge(d,m,by="Gene.name")
    result[with(result,Mutation >= Start & Mutation <= End),]
    
    #  Gene.name                Domain Start End Mutation
    #1     ABCF1 low_complexity_region     2  13       10
    #4     ABCF1                   AAA   328 532      335
    #6        F2    coiled_coil_region   499 558      499
    
    0 讨论(0)
提交回复
热议问题