[R] as.numeric() and POSIXct format

2011-08-24 Thread Agustin Lobo

Hi!

I'm confused by this:
 as.numeric(as.POSIXct(518400,origin=2001-01-01))
[1] 978822000

I guess the problem is that as.numeric() assumes a different origin, but cannot 
find
any default origin.

How can I get back the seconds from the POSIXct format? In other words, which 
the inverse function of as.POSIXct()?
I've tried as.numeric and unclass() using a origin= argument, but this does not 
work.


Thanks

Agus

--
Dr. Agustin Lobo
Institut de Ciencies de la Terra Jaume Almera (CSIC)
LLuis Sole Sabaris s/n
08028 Barcelona
Spain
Tel. 34 934095410
Fax. 34 934110012
email: agustin.l...@ija.csic.es

__
R-help@r-project.org mailing list
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.


Re: [R] as.numeric() and POSIXct format

2011-08-24 Thread Justin Haynes
as.POSIXct(518400,origin='2001-01-01')
[1] 2001-01-07 PST


as.POSIXct(as.numeric(as.POSIXct(518400,origin='2001-01-01')),origin='1970-01-01')
[1] 2001-01-07 08:00:00 PST


On Wed, Aug 24, 2011 at 9:22 AM, Agustin Lobo agustin.l...@ija.csic.eswrote:

 Hi!

 I'm confused by this:
  as.numeric(as.POSIXct(518400,**origin=2001-01-01))
 [1] 978822000

 I guess the problem is that as.numeric() assumes a different origin, but
 cannot find
 any default origin.

 How can I get back the seconds from the POSIXct format? In other words,
 which the inverse function of as.POSIXct()?
 I've tried as.numeric and unclass() using a origin= argument, but this does
 not work.

 Thanks

 Agus

 --
 Dr. Agustin Lobo
 Institut de Ciencies de la Terra Jaume Almera (CSIC)
 LLuis Sole Sabaris s/n
 08028 Barcelona
 Spain
 Tel. 34 934095410
 Fax. 34 934110012
 email: agustin.l...@ija.csic.es

 __**
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/**listinfo/r-helphttps://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/**
 posting-guide.html http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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.