R没有正确排序数据 - 跳过E值

时间:2017-07-27 16:58:42

标签: r

我正在尝试通过列weightFisher订购数据。但是,几乎就像R不会将e值处理得那么低,因为当我尝试从最小到最大的顺序时,所有的e值都会被跳过。

代码:

resultTable_bon <- GenTable(GOdata_bon,
                           weightFisher = resultFisher_bon,
                           weightKS = resultKS_bon,
                           topNodes = 15136,
                           ranksOf = 'weightFisher'
)
head(resultTable_bon)

#create Fisher ordered df
indF <- order(resultTable_bon$weightFisher)
resultTable_bonF <- resultTable_bon[indF, ]

resultTable_bon的样子:

       GO.ID                             Term Annotated Significant Expected Rank in weightFisher
1 GO:0019373         epoxygenase P450 pathway        19          13     1.12                    1
2 GO:0097267   omega-hydroxylase P450 pathway         9           7     0.53                    2
3 GO:0042738 exogenous drug catabolic process        10           7     0.59                    3
  weightFisher weightKS
1      1.9e-12  0.79744
2      7.9e-08  0.96752
3      2.5e-07  0.96336

什么&#34;命令&#34; resultTable_bonF看起来像:

        GO.ID                                        Term Annotated Significant Expected Rank in weightFisher
17 GO:0014075                           response to amine        33           7     1.95                   17
18 GO:0034372 very-low-density lipoprotein particle re...        11           5     0.65                   18
19 GO:0060710                     chorio-allantoic fusion         6           4     0.35                   19
   weightFisher weightKS
17      0.00014  0.96387
18      0.00016  0.83624
19      0.00016  0.92286

2 个答案:

答案 0 :(得分:1)

正如@bhas所说,它似乎正如你所希望的那样正常工作。也许使用head()使你感到困惑?

为了让您放心,请尝试使用更简单的方法

dtf <- data.frame(a=c(1, 8, 6, 2)^-10, b=c(7, 2, 1, 6))

dtf
             # a b
# 1 1.000000e+00 7
# 2 9.313226e-10 2
# 3 1.653817e-08 1
# 4 9.765625e-04 6

dtf[order(dtf$a), ]
             # a b
# 2 9.313226e-10 2
# 3 1.653817e-08 1
# 4 9.765625e-04 6
# 1 1.000000e+00 7

答案 1 :(得分:0)

尝试以下方法:

resultTable_bon$weightFisher <- as.numeric (resultTable_bon$weightFisher) 

然后:

resultTable_bonF <- resultTable_bon[order(resultTable_bonF$weightFisher),]