2017-07-27 65 views
0

我試圖按列weightFisher訂購數據。但是,就好像R不會將e值處理得太低一樣,因爲當我嘗試從最小到最大的順序時,所有e值都會跳過。R沒有正確訂購數據 - 跳過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 

什麼是 「有序」 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 
+3

你能提供一個試試[重複的例子?(https://stackoverflow.com/questions/5963269/how-to-make- a-great-r-reproducible-example)如果他們能夠重現您的問題,那麼其他人會更容易回答您的問題。 – Florian

+1

使用'?order'閱讀'order'的幫助。並使用順序的參數'遞減'。 R正在按照您要求的方式進行操作。 – Bhas

+0

我希望它增加。通過e值,我的意思是負e值。看看第一張桌子的weightFisher值如何很低,但是當我嘗試訂購時,在下一張桌子中,最低價格並不在第一位。 – merryberry

回答

0

嘗試以下操作:

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

然後:

resultTable_bonF <- resultTable_bon[order(resultTable_bonF$weightFisher),] 
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