sorting a list of probe ID's according to length of vectors
2
0
Entering edit mode
Assa Yeroslaviz ★ 1.5k
@assa-yeroslaviz-1597
Last seen 6 weeks ago
Germany
Hello everybody, I have a list of over 9000 EntrezID . each lines contains one or probe-IDs as here: > head(probeSetList) $`10` [1] "38912_at" $`100` [1] "41654_at" "907_at" $`1000` [1] "2053_at" "2054_g_at" $`10000` [1] "40781_at" $`10001` [1] "35430_at" "35431_g_at" "35432_at" $`10002` [1] "31366_at" "31667_r_at" I would like to sort this list according to the length of the single vectors inside it. so to sayat the top are the ENTREZIDs with the largest number of probe IDs. (in my example $`10001` with 3, but I have some with more!). I tried with order and sort command, but that didn't work. I will be happy to hear some advices on how to do it. THX in advance Assa -- Assa Yeroslaviz Kockelsberg 22 51371 Leverkusen [[alternative HTML version deleted]]
• 855 views
ADD COMMENT
0
Entering edit mode
@sean-davis-490
Last seen 4 months ago
United States
On Fri, Jan 22, 2010 at 6:45 AM, Assa Yeroslaviz <frymor at="" gmail.com=""> wrote: > Hello everybody, > > I have a list of over 9000 EntrezID . each lines contains one or probe-IDs > as here: > >> head(probeSetList) > $`10` > [1] "38912_at" > > $`100` > [1] "41654_at" "907_at" > > $`1000` > [1] "2053_at" ? "2054_g_at" > > $`10000` > [1] "40781_at" > > $`10001` > [1] "35430_at" ? "35431_g_at" "35432_at" > > $`10002` > [1] "31366_at" ? "31667_r_at" > > > I would like to sort this list according to the length of the single vectors > inside it. so to sayat the top are the ENTREZIDs with the largest number of > probe IDs. (in my example $`10001` with 3, but I have some with more!). > > I tried with order and sort command, but that didn't work. > > I will be happy to hear some advices on how to do it. counts = sapply(probeSetList,length) head(probeSetList[order(counts)]) This is untested but will hopefully give you an idea. Sean
ADD COMMENT
0
Entering edit mode
@cei-abreu-goodger-4433
Last seen 9.8 years ago
Mexico
something like this should work... probeSetList <- probeSetList[order(unlist(lapply(probeSetList, length)))] Assa Yeroslaviz wrote: > Hello everybody, > > I have a list of over 9000 EntrezID . each lines contains one or probe-IDs > as here: > >> head(probeSetList) > $`10` > [1] "38912_at" > > $`100` > [1] "41654_at" "907_at" > > $`1000` > [1] "2053_at" "2054_g_at" > > $`10000` > [1] "40781_at" > > $`10001` > [1] "35430_at" "35431_g_at" "35432_at" > > $`10002` > [1] "31366_at" "31667_r_at" > > > I would like to sort this list according to the length of the single vectors > inside it. so to sayat the top are the ENTREZIDs with the largest number of > probe IDs. (in my example $`10001` with 3, but I have some with more!). > > I tried with order and sort command, but that didn't work. > > I will be happy to hear some advices on how to do it. > > THX in advance > > Assa
ADD COMMENT

Login before adding your answer.

Traffic: 751 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6