-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: Support for "week" in floor_date
function
#11
Comments
First off I'm so happy you like the Tidier and find it enjoyable and valuable in your work flow. There's no reason why I didn't include I think your solution looks mighty elegant. If you throw it in a PR and add a docstring example that passes for it in the |
Sounds good! I just wanted to make sure the reason wasn't like "it is actually extremely complicated and will break everything if we try to add this." 😄 I'll go ahead and add the docstrings and put a PR together. |
Sounds good! Thank you ! |
#11: add "week" as a unit for `floor_date`
awesome, ill go ahead and bump version and release momentarily here |
Hello! Love the
Tidier
project, and have just started trying to use it in my own workflows!One thing that I find myself doing often in R is to take a set of dates and aggregate it on a weekly basis, with the week starting on Sunday. Using
lubridate
, that typically looks something like this:However,
"week"
is not a supported argument infloor_date
inTidierDates.jl
. I did some initial exploration of this, and noticed thatDates
does have afirstdayofweek
function which returns the first Monday of a week given someTimeType
.lubridate
by default uses Sunday as the start of the week, so my first pass at a solution to add this functionality toTidierDates.jl
looks like this:Which uses
Dates.firstdayofweek
to determine the Monday of the week of a provided date, then subtracts a day to return the Sunday (again, the base behavior oflubridate
in R if you don't override theweek_start
option).Now of course, one could do something like this without
floor_date
. But it would be very convenient for "week" to be supported in this function!I have a few questions on this:
"week"
was not supported initially?The text was updated successfully, but these errors were encountered: