I would like to import a time-series where the first field indicates a period:
08:00-08:15
08:15-08:30
08:30-08:45
Does R have any features to do this neatly?
Thanks!
Update:
The most promising solution I found, as suggested by Godeke was the cron package and using substring() to extract the start of the interval.
I’m still working on related issues, so I’ll update with the solution when I get there.
So you’re given a character vector like
c("08:00-08:15",08:15-08:30)and you want to convert to an internal R data type for consistency? Check out the help files for POSIXt and strftime.How about a function like this:
This will take a character vector like you described, and return a list of the same length, each element of which is a POSIXt 2-vector giving the start and end times (on today’s date). If you want you could add a
paste("1970-01-01",x)somewhere inside the function to standardize the date you’re looking at if it’s an issue.Does that help at all?