expand_open_hours | R Documentation |
This function takes the open_hours
variable in an already-read Core file (stored as a data.table
) and expands it to seven list
-type columns, where the elements of the list in each row are a set of vectors for opening/closing times, in military time format (1:30PM = 13.5). So an observation of c(8,10,12,14)
would be a business that opens at 8, closes at 10, opens again at noon, and closes again at 2PM on that day. Options are available to produce long instead of wide expansions as well.
expand_open_hours( dt, format = c("wide", "long", "long-expand", "long_expand"), open_hours = "open_hours", colnames = NULL, drop_missing = FALSE, convert_hour = TRUE, days = c("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday") )
dt |
A |
format |
Can be |
open_hours |
A character variable with the name of the |
colnames |
For |
drop_missing |
Drop any rows with a missing |
convert_hour |
Convert hour strings like |
days |
A character vector of the days to keep. Cutting down here can save some time/memory especially if you are not going |
Returns the same data.table
but with the new columns/rows added. May change the order of the data.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.