2014-09-20 54 views
16

我的圖表以y符號的形式顯示y軸上的值。我應該使用哪個命令來獲取數字形式的值。使用的文件中的值是數字形式? 感謝如何防止R中的科學記數法?

+4

什麼是「e符號」?科學計數法?你可以用'options(scipen = 999)'把它關掉,然後用'options(scipen = 0)'' – 2014-09-20 06:43:13

+0

'再次打開謝謝謝謝你的回答 – 2014-09-20 07:02:15

回答

25

要設置使用科學記數法在整個R對話,您可以用scipen選項。從文檔(?options):

‘scipen’: integer. A penalty to be applied when deciding to print 
      numeric values in fixed or exponential notation. Positive 
      values bias towards fixed and negative towards scientific 
      notation: fixed notation will be preferred unless it is more 
      than ‘scipen’ digits wider. 

因此,在本質上,這價值決定了它是如何可能的科學記數法將被觸發。因此,爲了防止科學記數法,只需使用一個很大的正值,如999

options(scipen=999) 
+0

,但是這樣做會增加許多traling零, – brucezepplin 2018-02-20 15:41:54

22

嘗試「格式化」功能:

> xx = 100000000000 
> xx 
[1] 1e+11 
> format(xx, scientific=F) 
[1] "100000000000"