[R] Pb with date time sequence with period<1sec

DE david.ecotiere at cerema.fr
Wed Sep 9 10:19:34 CEST 2015


Hi,

I'd like to create a date-time seq with a period of 0.05 s, over several
days. 

# try :
start<-strptime(nom_fich,format="%y%m%d")
time<-seq(from=start, by=0.05, length.out = 86400*20*3)
print(as.POSIXlt(time[2])$sec)
# result is 0.04999995 and not 0.05 as expected

But If I am looking at the sequence, the seconds are not separated by 0.05,
but by something very close (0.04999995). Same pb if I want to add a
fraction of seconds to a date-time object :

# try :
start<-strptime(nom_fich,format="%y%m%d")
as.POSIXlt(start+0.05,origin="1970-01-01")$sec
# result is 0.04999995 and not 0.05 as expected

Any idea to solve this pb ?

Thank you in advance !




--
View this message in context: http://r.789695.n4.nabble.com/Pb-with-date-time-sequence-with-period-1sec-tp4712040.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list