Thanks! chron() is very useful indeed. Just out of interest, is it possible to do, say in this case, the number of months (or quarters) after January 1986? i.e. use a different time interval?
On Mon, 15 Dec 2003, Gabor Grothendieck wrote: > What you can do to handle this timezone problem is either to use > POSIXt with GMT or use chron (which does not use timezones so > can't cause problems like this): > > Suppose: > > SLDATX <- c( "1986-01-06", "1986-01-17", "1986-02-02", "1986-02-04", > ,"1986-02-04", "1986-02-21", "1986-03-06", "1986-03-25", > ,"1986-04-06", "1986-04-10" ) > > # then using POSIXt in the GMT timezone: > > TIMESOLD <- as.numeric( julian( as.POSIXlt( SLDATX, tz="GMT" ), > origin = as.POSIXct( "1986-01-01", tz = "GMT" ) ) ) > > # or the alternative using chron: > > require(chron) > TIMESOLD2 <- as.numeric( chron( SLDATX, format="y-m-d", > origin = c( month = 1, day = 1, year = 1986 ) ) ) > > all.equal(TIMESOLD,TIMESOLD2) > -- Cheers, Kevin --------------------------------------------------------------- "Try not. Do, do! Or do not. There is no try" Jedi Master Yoda ---- Ko-Kang Kevin Wang, MSc SLC STATS 10x Workshop Coordinator University of Auckland New Zealand Homepage: http://www.stat.auckland.ac.nz/~kwan022 Ph: 373-7599 x88475 ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help