[R] No "number of days" format for 'difftime'?

John Kane jrkrideau at inbox.com
Mon Aug 8 11:50:51 CEST 2016


Try 
d <- as.difftime("6-08:18:33","%d-%H:%M:%S")

John Kane
Kingston ON Canada


> -----Original Message-----
> From: loris.bennett at fu-berlin.de
> Sent: Mon, 8 Aug 2016 11:37:33 +0200
> To: r-help at stat.math.ethz.ch
> Subject: [R] No "number of days" format for 'difftime'?
> 
> Hi,
> 
> When I try
> 
>   d <- as.difftime("6-08:18:33",format=%d-%H:%M:%S")
> 
> I get:
> 
>   Error: unexpected SPECIAL in "as.difftime("6-08:18:33",format=%d-%"
> 
> Am I correct in thinking that it is not possible to do something like
> this, because there is no character string for the format which
> corresponds to "number of days"?
> 
> I could misuse "%j" for "day of the year as a decimal number", but
> ultimately the "difftime" object is still a data, rather than a length
> of time and I should be looking at a package like 'lubridate' instead.
> Is that the case?
> 
> Cheers,
> 
> Loris
> 
> --
> Dr. Loris Bennett (Mr.)
> ZEDAT, Freie Universität Berlin         Email loris.bennett at fu-berlin.de
> 
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

____________________________________________________________
Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.



More information about the R-help mailing list