You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
this works, but not sure how to accomplish with filter_time
example %>%
filter(hour(date)>2 & hour(date)<=4)
# A time tibble: 4 x 1
# Index: date
date
<dttm>
1 2013-01-01 03:00:00
2 2013-01-01 04:00:00
3 2013-01-02 03:00:00
4 2013-01-02 04:00:00
Great question. The simple answer is, you can't! At least not yet.
I've been thinking about this for awhile, and have termed them "continuous" vs "disjoint" filters. Continuous range filters are available (entire months / entire days where there is no break between days), but disjoint are not.
I've been toying with the idea of "wildcard filters" in filter_time() but haven't gotten around to implementing because I dont know how useful it would be. But it would solve your problem. It might look something like:
example %>% time_filter("?-?-? 03"~"?-?-? 04")
Its strange looking, but would essentially be saying "for every day, filter only the rows with hours from 3-4"
Other applications would be:
example %>% time_filter("?-?-12"~"?-?-15")
The 12th-15th days of every month in your series.
But again, what you have already using lubridate is pretty easy too, which is another reason it hasnt happened yet.
Great stuff with
tibbletime
. How can I usefilter_time()
to get a specific time window each day? For instance, just the hours of 02:00 to 04:00?The text was updated successfully, but these errors were encountered: