[R] a R question

ripley@stats.ox.ac.uk ripley at stats.ox.ac.uk
Wed Mar 20 12:25:42 CET 2002


On Wed, 20 Mar 2002, [iso-8859-1] Jesús Fernández Gálvez wrote:

> Dear Sir,
>
> I have been working with R  for some time now and I am very happy with
> it, but I have found a problem that I could not resolve. Could you
> please give me some hint about how to transform  POSIX time data in
> seconds to  string  format?. (eg. 995752800 -> year-month,day,hour,min,
> sec) I tryed with Sys.time(), strptime() and date() but without success.

Is that the number of seconds since 1970-01-01?

> x <- 995752800
> class(x) <- c("POSIXt", "POSIXct")
> x
[1] "2001-07-21 23:00:00 GMT Daylight Time"

in my locale.  Use format on `x' to get the format you want.

(This is deliberately not made easy by as.POSIXct, as there is no
way to check the numbers are indeed POSIX times.)

-- 
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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list