Re: [R] converting from numeric to Date

2006-11-23 Thread jim holtman
> Limite_x<-c(1131408000,1163548800)
> structure(Limite_x, class=c("POSIXt","POSIXct"))
[1] "2005-11-07 19:00:00 Eastern Standard Time" "2006-11-14 19:00:00
Eastern Standard Time"
>


On 11/23/06, COMTE Guillaume <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I have a Date, that has been converted to a number that represent the
> count of seconds since year 1970, how do i convert it to a date ?
>
>
>
> Example :
>
>
>
> >Limite_x<-c(1131408000,1163548800)
>
> >is(limite_x)
>
> [1] "numeric" "vector"
>
>
>
> But these numbers are dates, did R provide something that give you the
> date from this numeric vector ?
>
>
>
> Thks all.
>
>
>
> COMTE Guillaume.
>
>
>[[alternative HTML version deleted]]
>
> __
> R-help@stat.math.ethz.ch 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.
>


-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

__
R-help@stat.math.ethz.ch 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] converting from numeric to Date

2006-11-23 Thread Peter Dalgaard
"COMTE Guillaume" <[EMAIL PROTECTED]> writes:

> Hi all,
> 
> I have a Date, that has been converted to a number that represent the
> count of seconds since year 1970, how do i convert it to a date ?

> Example :

> >Limite_x<-c(1131408000,1163548800)
> 
> >is(limite_x)
> 
> [1] "numeric" "vector"

Not really:

> is(limite_x)
Error in .class1(object) : object "limite_x" not found

(Point being that you should be careful when citing R output that it
really is feasible output.)

> But these numbers are dates, did R provide something that give you the
> date from this numeric vector ?

Just add the origin:

> Limite_x + ISOdatetime(1970,1,1,0,0,0)
[1] "2005-11-08 CET" "2006-11-15 CET"

or (watch it!)

> Limite_x/24/3600 + as.Date("1970-1-1")
[1] "2005-11-08" "2006-11-15"

-- 
   O__   Peter Dalgaard Ă˜ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
R-help@stat.math.ethz.ch 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.