Skip to content
Prev 363213 / 398502 Next

No "number of days" format for 'difftime'?

Martin Maechler <maechler at stat.math.ethz.ch> writes:
My apologies, you are absolutely right - I see the error of my ways.
The only feeble defence I can mount is that the usage example from
?as.difftime

  as.difftime(tim, format = "%X", units = "auto")

superficially disguises the fact that the first argument is also a named
argument with the name 'tim'.  I think I had assumed that the initial
argument were always positional, e.g. as for paste0

  paste0(..., collapse = NULL)

However, I now realise that '...' also generates named arguments, e.g.

  paste0(..1='a',..2='b')

So as a non-beginner but infrequent R user, in future I shall try use
the explicit form more often, e.g.

  as.difftime(tim = "4-03:02:01", format = "%d-%H:%M:%S")

to remind myself what I am doing.

So fortune(350) really is true.  I just didn't believe enough to read
enough. 

Loris