Skip to content

extraction of days component of duration #1193

@trizniak

Description

@trizniak

cannot figure out how to extract the number of days in duration ¯\_(ツ)_/¯

lubridate::duration("31d 21H 25M 30S")
[1] "2755530s (~4.56 weeks)"

but

lubridate::duration("31d 21H 25M 30S") %>% lubridate::days()
[1] "2755530d 0H 0M 0S"
lubridate::duration("31d 21H 25M 30S") %>% lubridate::day()
[1] 1
lubridate::duration("31d 21H 25M 30S") %>% lubridate::duration(units="days")
[1] "238077792000s (~7544.23 years)"

additional question : shouldn't the hour/minute/second components of a duration be extracted by hourS/minuteS/secondS?
because

lubridate::duration("31d 21H 25M 30S") %>% lubridate::hour()
[1] 21
lubridate::duration("31d 21H 25M 30S") %>% lubridate::hours()
[1] "2755530H 0M 0S"

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