GithubHelp home page GithubHelp logo

Comments (9)

hadley avatar hadley commented on July 18, 2024

I think we should consider this the default for large numbers

from pillar.

randomgambit avatar randomgambit commented on July 18, 2024

this package is clearly going in the right direction!! :)

from pillar.

krlmlr avatar krlmlr commented on July 18, 2024

This is now implemented, at most 13 decimal places (including the dot) are printed.

library(tibble)
tibble(x = 1e12)
#> # A tibble: 1 x 1
#>               x
#>           <dbl>
#> 1 1000000000000
tibble(x = 1e13)
#> # A tibble: 1 x 1
#>         x
#>     <dbl>
#> 1 1.00e13
tibble(x = 1e-10)
#> # A tibble: 1 x 1
#>              x
#>          <dbl>
#> 1 0.0000000001
tibble(x = 1e-11)
#> # A tibble: 1 x 1
#>          x
#>      <dbl>
#> 1 1.00e-11

Created on 2019-05-03 by the reprex package (v0.2.1)

from pillar.

hadley avatar hadley commented on July 18, 2024

The exponents aren't divisible by three in your examples

from pillar.

krlmlr avatar krlmlr commented on July 18, 2024

Right, I was confused.

from pillar.

randomgambit avatar randomgambit commented on July 18, 2024

sorry why would they need to be divisible by three?!

from pillar.

krlmlr avatar krlmlr commented on July 18, 2024

That's what makes engineering notation different from scientific notation.

from pillar.

krlmlr avatar krlmlr commented on July 18, 2024

Would you like to test-drive num(), available in pillar 1.5.1.9002, to be released as pillar 1.6.0? After release, I'll reexport this the constructor from tibble too. See https://pillar.r-lib.org/dev/articles/numbers.html for a documentation stub.

library(pillar)
library(tibble)

x <- c(543123578890.23, 240234.131, 40234.1)
col_a <- num(x, notation = "eng")

col_a
#> <tibble_num(eng)[3]>
#> [1] 543.00e9 240.00e3  40.20e3
tibble::tibble(x, col_a)
#> # A tibble: 3 x 2
#>               x    col_a
#>           <dbl>    <eng>
#> 1 543123578890. 543.00e9
#> 2       240234. 240.00e3
#> 3        40234.  40.20e3

Created on 2021-04-03 by the reprex package (v1.0.0)

The scientific display is still a bit off, working on it.

from pillar.

github-actions avatar github-actions commented on July 18, 2024

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.

from pillar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.