Skip to content

Inconsistency between tibble and vector formatting if "hours" component is zero #112

Description

@markconnolly

A tibble column renders in a console as (apparently) degree minutes and degree seconds rather than time hours:minutes:seconds if all occurrences have zero hours. Renders consistently and as expected in a notebook context, so impact is tiny. Merely disconcerting when trying things in the console.

library(tidyverse)

paces <- as_tibble_col(c("00:05:07", "00:05:25", "00:05:34",
                         "00:06:20", "00:06:21") %>% 
                         hms::as_hms(), column_name = "pace")
paces
#> # A tibble: 5 x 1
#>   pace  
#>   <time>
#> 1 05'07"
#> 2 05'25"
#> 3 05'34"
#> 4 06'20"
#> 5 06'21"
paces$pace
#> 00:05:07
#> 00:05:25
#> 00:05:34
#> 00:06:20
#> 00:06:21


paces2 <- as_tibble_col(c("01:05:07", "00:05:25", "00:05:34", 
                         "00:06:20", "00:06:21") %>% 
                         hms::as_hms(), column_name = "pace")
paces2
#> # A tibble: 5 x 1
#>   pace    
#>   <time>  
#> 1 01:05:07
#> 2 00:05:25
#> 3 00:05:34
#> 4 00:06:20
#> 5 00:06:21
paces2$pace
#> 01:05:07
#> 00:05:25
#> 00:05:34
#> 00:06:20
#> 00:06:21

Created on 2022-10-26 by the reprex package (v2.0.1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions