I want to create a time series with tibbletime for specific dates. I have:
Data_Start<-"2015-09-07 01:55:00 UTC"
Data_End<-"2015-09-10 01:59:00 UTC"
and I want to create a timeseries, with minute samples, like with:
create_series(2015-09-07 + 01:55:00 ~ 2015-09-10 + 01:59:00,1~M)
The parameters should be a time_formula, described on page 17 here: https://cran.r-project.org/web/packages/tibbletime/tibbletime.pdf
This works, but I cannot pass the parameters like:
create_series(Data_Start~Data_End,1~M)
Tried out already different things for converting the string, but nothing worked so far :(
Author of
tibbletime
here. An issue on GitHub was raised about this recently. The solution is to userlang::new_formula()
to pre-construct the formula. We also need a special helper function that can handle adding the+
in the formula if using POSIXct dates.Here is the helper:
Use the helper function with date versions of your start and end dates
Produces:
In a future release of
tibbletime
I will likely include a more robust verson of thecreate_time_formula()
helper function for this case.Update:
tibbletime 0.1.0
has been released, and a more robust implementation allows for directly using variables in the formula. Additionally, each side of the formula must be a character or an object of the same class as the index now (i.e.2013 ~ 2014
should be"2013" ~ "2014"
).