[R] Time conversion problems

mgilgen at swissonline.ch mgilgen at swissonline.ch
Wed Aug 22 08:20:59 CEST 2007


Hi there

I have precipitation data from 2004 to 2006 in varying resolutions (10 to 20min intervals) with time in seconds from beginnig of the year (summation) and a second variable as year.

I applied follwing code to convert the time into a date:

times<-strptime("2004-01-01", "%Y-%m-%d", tz="GMT") + precipitation$time1

everytihng went well, except that every year, the seconds-counter starts by zero, therefore I have now three 2004 series instead of going further from 04 to 05 etc.

I tried to sum the last seconds-values of 2004 to the first of 2005 with an if command like:

if (year=2005) time2=time1+632489 ;(seconds)

but it doesn't work.

thanks for a solution

marc



More information about the R-help mailing list