Search code examples
rtidyverselargenumbertibble

Print a single large number with underlined 3-digit groups as in a tibble?


Example:

# tidyverse packages are supposed to be installed
require(tibble)
set.seed(20180819)
large_int <- floor(runif(1)*1e12)
as_tibble(large_int)

This sample code produces on most consoles (inside RStudio it does) :

# A tibble: 1 x 1
     value
     <dbl>
1 697358430130
  ---   ---   

In fact the underlined number is more like ̲6̲9̲7358̲4̲3̲0130 but underlined digits are tricky to produce on stackoverflow

Here is my question how to produce the same output for the value without using a tibble ?


Solution

  • Thanks to hplieniniger, I can answer my own question

    require(pillar)
    pillar(123456789)