[R] A Question Re ISOdatetime

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Dec 14 17:39:39 CET 2011

On 14/12/2011 16:24, Alex Zhang wrote:
> Dear all,
> I am using the ISOdatetime function like this:
> test.info$TradeTime = with(test.info, mapply(FUN = ISOdatetime, Year, Month, Day, Hour, Minute, 60, "EST"))
> Where Year, Month etc are all numeric.
> I think ISOdatetime should return a POSIXct object. However, the result I obtained from the line above is all numeric. Could you please advise? I wish to get POSIXct.

ISOdatetime did: mapply threw away the class.
See its SIMPLIFY argument, which defaults to TRUE.
It this case it is unnecessary: e.g.

ISOdatetime(2011, c(11,12), c(30,1), 1, 30, 35, tz="EST")

A 'sec' value of 60 should not be used ... it indicates a leap second 
which POSIX ignores.

> Thank you very much.
> - Alex

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-help mailing list