I am pretty new to R, so maybe my question is not clear from the start, but I've a problem using the ymd_hms function of the lubridate package in R. I am trying to test the functionality of dygraph. I've a large dataset of temperature values with a interval of one hour. There's one specific timestamp which seem to pose the problem, which is : 2017/3/26 02:00:00
This is a sample of the dataset (called "weerdata.csv") to show you :
Meetdatum,Temperatuur
2017/3/26 01:00:00,11.10
2017/3/26 02:00:00,13.70
2017/3/26 03:00:00,14.90
2017/3/26 04:00:00,16.30
This is the code I am executing in the R console :
weerdata <- read.csv("F:/_data/gegevensverwerking/R/TESTSR/data/weerdata.csv")
weerdata$Meetdatum<- ymd_hms(weerdata$Meetdatum,tz=Sys.timezone())
time_series <- xts(weerdata, order.by = weerdata$Meetdatum)
dygraph(time_series) %>% dyRangeSelector()
The error that I receive is :
Error in xts::periodicity(data) : can not calculate periodicity of 1 observation
The problem is that 2017/3/26 02:00:00 is converted to NULL with the ymd_hms function. This problem does not occur when using for instance this dataset :
Meetdatum,Temperatuur
2017/3/26 11:00:00,11.10
2017/3/26 12:00:00,13.70
2017/3/26 13:00:00,14.90
2017/3/26 14:00:00,16.30
I've temperature values in my dataset from 2017/1/1 01:00:00 until 2017/5/28 09:00:00, and the only one that is posing a problem is 2017/3/26 02:00:00.
Does anyone has an idea ?
Thank you very much in advance.
Stijn, Belgium