ilarischeinin · GitHub

No, as I used formatC() instead of format(). (Because it seems to be slightly more efficient.)

But actually, while it makes no difference here, for glimpse() there is a small cosmetic choice to be made. With the code above (that uses formatC()), its output currently looks like this:

> glimpse(flights)
Observations: 336,776
Variables: 16
$ year      (int) 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 201...
$ month     (int) 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...

But with format() it would be possible to align the two numbers like this:

> glimpse(flights)
Observations: 336,776
Variables:         16
$ year      (int) 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 201...
$ month     (int) 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...

The reason I didn't align them is that I'd expect the number of variables to practically always be way way smaller than the number of observations (and to very very rarely actually use the thousands separator).

But if you'd prefer the aligned version, I'll change big_mark() from formatC() to format(), which will by default produce right-aligned output. Then the function call inside dim_desc() would also get back its trim=TRUE argument so that it'll continue to print

Source: local data frame [336,776 x 16]

instead of

Source: local data frame [336,776 x       16]

Read the original on github.com ↗