Hello guys,
I have some problems with the order function in R.What I am trying to do is to order by ("chr-name","chr-start","chr-end)
When I tried with the three it gave me just the two first columns, when I tried with only "chr-start", it worked but not as I wanted
Here is what I did and hopefully someone has an idea on how to do it
First try:
col=c("chr-nameRM","chr-startRM")
ordered1 <- chr_cancer [with(chr_cancer,order(col)),]
result:
chr-nameRM chr-startRM chr-endRM
chr1 839792 839815
chr1 859231 859271
second try:
ordered2 <- chr_cancer[order(chr_cancer[["chr-nameRM"]]),]
Result: This gave me half what I wanted as the chr names are not in order because what I am trying to do next is to compare other files.So if anyone has an idea I would be grateful
Thanks
Nobody would be able to answer this question without example data. And why do you use double brackets (
[["chr-nameRM"]]
)? If you're going to compare multiple tables maybe just simplesetkey
is all what you need.While I answered your "literal" question, can you elaborate on what you mean by "compare to other files"? How are you doing the comparison?
Hello, sorry for the late reply
Well I am using seqmonk as well and wanted to see if I come up with the same result files using R