zoukankan      html  css  js  c++  java
  • R语言中设置科学计数法显示

    1、问题

    > dis <- seq(100000, 10000000, 100000)
    > head(dis)     ## 为什么以科学计数法显示?
    [1] 1e+05 2e+05 3e+05 4e+05 5e+05 6e+05

    2、测试

    > a = 10000
    > a
    [1] 10000
    > a = 100000
    > a      ## 说明到10万就开始用科学计数法了
    [1] 1e+05
    > a = 1000000
    > a
    [1] 1e+06

    3、通过调整scipen调整是否以科学计数法显示

    > getOption("scipen")   ## 默认scipen是0
    [1] 0
    > options(scipen = 1)  ## 将scipen修改为1
    > a = 100000
    > a                    ## 可以正常显示10万了
    [1] 100000
    > a = 1000000         ## 只能多增加一位
    > a
    [1] 1e+06
    > getOption("scipen")
    [1] 1
    > options(scipen = 2)  ## 将scipen设置为2
    > a = 1000000          ## 可以正常显示百万了, 说明每增加1,可以多显示一位
    > a
    [1] 1000000
    > a = 10000000
    > a
    [1] 1e+07
    > getOption("scipen")
    [1] 2
    > options(scipen = 10)   ## 设置为10,则10万的基础上可以多显示10位
    > a = 10000000
    > a
    [1] 10000000
    > a = 100000000        
    > a
    [1] 100000000

    4、测试效果

    > options(scipen = 10)  ## 将scipen设置为10
    > getOption("scipen")
    [1] 10
    > dis <- seq(100000, 10000000, 100000)
    > head(dis)
    [1] 100000 200000 300000 400000 500000 600000
    > tail(dis)                                ## 测试, 没有问题
    [1]  9500000  9600000  9700000  9800000  9900000 10000000

    参考:https://www.cnblogs.com/xudongliang/p/9480249.html

  • 相关阅读:
    改善深层神经网络
    IO操作 第一篇 学习(转载)
    杂谈:收集的一些博文
    杭电2072
    Java数组常用方法
    JAVA中final修饰符小结
    南阳106
    南阳283
    南阳277
    南阳458
  • 原文地址:https://www.cnblogs.com/liujiaxin2018/p/15816003.html
Copyright © 2011-2022 走看看