Multiple unions

后端 未结 5 754
南笙
南笙 2021-01-04 08:00

I am trying to do unions on several lists (these are actually GRanges objects not integer lists but the priciple is the same), basically one big union.

x<         


        
5条回答
  •  时光说笑
    2021-01-04 08:41

    ok this works but I am curious why sapply seems to have its own scope

    x<-sort(sample(1:20, 9))
    y<-sort(sample(10:30, 9))
    z<-sort(sample(20:40, 9))
    mylists<-c("x","y","z")
    emptyList<-vector()
    for(f in mylists){emptyList<-union(emptyList,get(f))}
    

提交回复
热议问题