【发布时间】:2014-09-20 06:42:20
【问题描述】:
我的绘图以 e 表示法的形式在 y 轴上显示值。我应该使用哪个命令来获取数字形式的值。使用的文件中的值是数字形式吗? 谢谢
【问题讨论】:
-
什么是“e 表示法”?科学计数法?您可以使用
options(scipen = 999)将其关闭,然后使用options(scipen = 0)重新打开
标签: r
我的绘图以 e 表示法的形式在 y 轴上显示值。我应该使用哪个命令来获取数字形式的值。使用的文件中的值是数字形式吗? 谢谢
【问题讨论】:
options(scipen = 999) 将其关闭,然后使用 options(scipen = 0) 重新打开
标签: r
要在整个 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)
【讨论】:
试试format函数:
> xx = 100000000000
> xx
[1] 1e+11
> format(xx, scientific=F)
[1] "100000000000"
【讨论】: