Re: [R] as.Date question

2009-12-24 Thread Gabor Grothendieck
zzz1 is POSIXct so looking at: > as.Date.POSIXct function (x, ...) { z <- floor(unclass(x)/86400) attr(z, "tzone") <- NULL structure(z, class = "Date") } we see as.Date.POSIXct takes the POSIXct object, zzz1, and converts it to Date relative to GMT. There is no time zone argument on

Re: [R] as.Date question

2009-12-24 Thread Linlin Yan
e answer. > > Usually one has x=y --> f(x)=f(y) > > which doesn't seem to hold here (put x=zzz1, y=zzz2, f=as.Date()). > > Or do I overlook something? > > > - Original Message - From: "Marek Janad" > To: > Sent: Thursday, December 24, 20

Re: [R] as.Date question

2009-12-24 Thread MAL
Mark, not sure that's the answer. Usually one has x=y --> f(x)=f(y) which doesn't seem to hold here (put x=zzz1, y=zzz2, f=as.Date()). Or do I overlook something? - Original Message - From: "Marek Janad" To: Sent: Thursday, December 24, 2009 00:08 S

Re: [R] as.Date question

2009-12-23 Thread Marek Janad
Look at documentation ?as.Date as.Date first represents time in UTC, what gives: as.POSIXlt(zzz1, tz="UTC") HTH 2009/12/20 MAL : > All! > > This piece of code: > > zzz1 <- as.POSIXct("1999-03-18", tz="CET") > zzz2 <- as.POSIXlt("1999-03-18", tz="CET") > zzz1 == zzz2 > as.Date(zzz1) > as.Date(z

Re: [R] as.Date question

2009-12-21 Thread Felix Andrews
I don't know the details of why this is happening, but in any case it is a good idea to round() your times if you want to convert them to dates. Just as you would round() a numeric value to convert it to an integer. as.Date(round(zzz1, "days")) 2009/12/21 Jason Morgan : > Hello, > > On 2009.12.2

[R] as.Date question

2009-12-20 Thread MAL
All! This piece of code: zzz1 <- as.POSIXct("1999-03-18", tz="CET") zzz2 <- as.POSIXlt("1999-03-18", tz="CET") zzz1 == zzz2 as.Date(zzz1) as.Date(zzz2) yields TRUE for "zzz1==zzz2", but the two dates returned by as.Date are different: as.Date(zzz1) [1] "1999-03-17" as.Date(zzz2) [1] "199

Re: [R] as.Date question

2009-12-20 Thread Jason Morgan
Hello, On 2009.12.20 18:06:17, MAL wrote: > All! > > This piece of code: > > zzz1 <- as.POSIXct("1999-03-18", tz="CET") > zzz2 <- as.POSIXlt("1999-03-18", tz="CET") > zzz1 == zzz2 > as.Date(zzz1) > as.Date(zzz2) > > yields TRUE for "zzz1==zzz2", but the two dates returned by as.Date are > diff

[R] as.Date question

2009-12-20 Thread MAL
All! This piece of code: zzz1 <- as.POSIXct("1999-03-18", tz="CET") zzz2 <- as.POSIXlt("1999-03-18", tz="CET") zzz1 == zzz2 as.Date(zzz1) as.Date(zzz2) yields TRUE for "zzz1==zzz2", but the two dates returned by as.Date are different: > as.Date(zzz1) [1] "1999-03-17" > as.Date(zzz2) [1] "1999-