tidyverse / hms

A simple class for storing time-of-day values
https://hms.tidyverse.org/
Other
138 stars 25 forks source link

Is pillar printing too aggressive? #54

Closed DavisVaughan closed 6 years ago

DavisVaughan commented 6 years ago

When you have hours, minutes, and seconds it seems like the seconds aren't (ever?) printed. Is this intended? Seems to me that when you have a regular sequence like below, you would want to know what the second is so you could uniquely identify that row.

(tibble 1.4.2, hms 0.4.1 dev)

library(tibble)
library(hms)

tibble(test = hms(seconds = 7200:8500))
#> # A tibble: 1,301 x 1
#>    test  
#>    <time>
#>  1 02:00 
#>  2 02:00 
#>  3 02:00 
#>  4 02:00 
#>  5 02:00 
#>  6 02:00 
#>  7 02:00 
#>  8 02:00 
#>  9 02:00 
#> 10 02:00 
#> # ... with 1,291 more rows

Created on 2018-01-29 by the reprex package (v0.1.1.9000).

krlmlr commented 6 years ago

Thanks. This is intended, but I don't have a strong opinion. Would you still hide split-seconds in this example?

DavisVaughan commented 6 years ago

I would think showing hours, minutes, and seconds if seconds are available makes sense.

If split-seconds are also there, I was going to suggest following suit with pillar_shaft.POSIXt and print them if the digits.secs option was set, but it does not seem like hms respects that currently, (see format) so I'm not sure what to suggest. I don't feel as strongly about printing split-seconds by default, but some people might at least want an option to print them somehow.

krlmlr commented 6 years ago

Thanks for the nudge. I tweaked the formatting logic, let me know if it works for you.

DavisVaughan commented 6 years ago

Sorry for the delay but this looks great now, thanks!

github-actions[bot] commented 3 years ago

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.