I have the following data frame.
Ensembl_ID GeneNames score
ENSG00000011422 PLAUR 39.5685
ENSG00000078328 A2BP1 50.00768
ENSG00000081803 CADPS2 64.84489
ENSG00000105976 MET 97.11081
ENSG00000106366 SERPINE1 48.43963
ENSG00000108576 SLC6A4 164.60561
ENSG00000114062 UBE3A 59.33749
ENSG00000115840 SLC25A12 77.22506
ENSG00000146938 NLGN4X 57.59011
ENSG00000151067 CACNA1C 54.06404
ENSG00000152969 JAKMIP1 57.64859
ENSG00000162946 DISC1 53.13775
ENSG00000164418 GRIK2 22.93073
ENSG00000166206 GABRB3 92.59465
ENSG00000166501 PRKCB 105.63476
ENSG00000172893 DHCR7 99.53791
ENSG00000174469 CNTNAP2 174.89443
ENSG00000180914 OXTR 90.86565
ENSG00000189056 RELN 85.79417
ENSG00000196338 NLGN3 37.61191
ENSG00000251322 SHANK3 172.93547
ENSG00000259207 ITGB3 144.50998
I just use the following to sort the data frame
j_test <- j[order(round(as.numeric(j$Raw_score)),decreasing = TRUE, na.last = TRUE), ]
It does the following. Any thing above 100 is ignored and appears down the list as below. I want it to be sorted correctly.
Ensembl_ID GeneNames Score
ENSG00000172893 DHCR7 99.53791
ENSG00000105976 MET 97.11081
ENSG00000166206 GABRB3 92.59465
ENSG00000180914 OXTR 90.86565
ENSG00000189056 RELN 85.79417
ENSG00000115840 SLC25A12 77.22506
ENSG00000081803 CADPS2 64.84489
ENSG00000114062 UBE3A 59.33749
ENSG00000152969 JAKMIP1 57.64859
ENSG00000146938 NLGN4X 57.59011
ENSG00000151067 CACNA1C 54.06404
ENSG00000162946 DISC1 53.13775
ENSG00000078328 A2BP1 50.00768
ENSG00000106366 SERPINE1 48.43963
ENSG00000011422 PLAUR 39.5685
ENSG00000196338 NLGN3 37.61191
ENSG00000164418 GRIK2 22.93073
ENSG00000174469 CNTNAP2 174.89443
ENSG00000251322 SHANK3 172.93547
ENSG00000108576 SLC6A4 164.60561
ENSG00000259207 ITGB3 144.50998
You seem to have given the wrong column name in the sort function.
j_test <- j[order(round(as.numeric(j$score)),decreasing = TRUE, na.last = TRUE), ]
Sample output:
Ensembl_ID GeneNames score
17 ENSG00000174469 CNTNAP2 174.89443
21 ENSG00000251322 SHANK3 172.93547
6 ENSG00000108576 SLC6A4 164.60561
22 ENSG00000259207 ITGB3 144.50998
15 ENSG00000166501 PRKCB 105.63476
16 ENSG00000172893 DHCR7 99.53791
4 ENSG00000105976 MET 97.11081
14 ENSG00000166206 GABRB3 92.59465
18 ENSG00000180914 OXTR 90.86565
19 ENSG00000189056 RELN 85.79417
8 ENSG00000115840 SLC25A12 77.22506
3 ENSG00000081803 CADPS2 64.84489
7 ENSG00000114062 UBE3A 59.33749
9 ENSG00000146938 NLGN4X 57.59011
11 ENSG00000152969 JAKMIP1 57.64859
10 ENSG00000151067 CACNA1C 54.06404
12 ENSG00000162946 DISC1 53.13775
2 ENSG00000078328 A2BP1 50.00768
5 ENSG00000106366 SERPINE1 48.43963
1 ENSG00000011422 PLAUR 39.56850
20 ENSG00000196338 NLGN3 37.61191
13 ENSG00000164418 GRIK2 22.93073
Also, I don't see how the round() function is necessary.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.