-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
format.hms() accepting argument format #125
Comments
Thanks. The hms type inherits from difftime, that type doesn't seem to support the d <- Sys.time() - Sys.time()
d
#> Time difference of -9.536743e-07 secs
format(d, "%H")
#> Error in prettyNum(.Internal(format(x, trim, digits, nsmall, width, 3L, : invalid 'trim' argument Created on 2024-11-10 with reprex v2.1.1 Here's what I think happens: format.difftime
#> function (x, ...)
#> {
#> if (length(x))
#> paste(format(unclass(x), ...), units(x))
#> else character()
#> }
#> <bytecode: 0x10527d070>
#> <environment: namespace:base>
formals(format.default)
#> $x
#>
#>
#> $trim
#> [1] FALSE
#>
#> $digits
#> NULL
#>
#> $nsmall
#> [1] 0
#>
#> $justify
#> c("left", "right", "centre", "none")
#>
#> $width
#> NULL
#>
#> $na.encode
#> [1] TRUE
#>
#> $scientific
#> [1] NA
#>
#> $big.mark
#> [1] ""
#>
#> $big.interval
#> [1] 3
#>
#> $small.mark
#> [1] ""
#>
#> $small.interval
#> [1] 5
#>
#> $decimal.mark
#> getOption("OutDec")
#>
#> $zero.print
#> NULL
#>
#> $drop0trailing
#> [1] FALSE
#>
#> $... Created on 2024-11-10 with reprex v2.1.1 |
Thanks for the reply! |
There seems to be a
format()
S3 method for class 'hms'. However, it just returns the input as character. I would have expected that it takes the argumentformat
and formats the output like an object of classPOSIXct
Created on 2024-11-05 with reprex v2.1.1
The text was updated successfully, but these errors were encountered: