Option request: add parameter to set week start (Sunday vs Monday) #257
Comments
I would also like to see this feature and suggest it be made for all relevant functions. I just came across this myself when using It is probably easiest if you make it general to take a |
In addition to being useful with Happy to work on this if it sounds like a good idea. |
I think it would be very useful. We just have to check that all lubridate code doesn't explicitly rely on the first day being Sunday. If it were after me I would even change the default to Monday as that's how iso defines it. |
This would be a very useful feature. Just to emphasise the point: I would especially like to have this enabled floor_date when executed with unit="week". Maybe introduce a unit "isoweek" or an option for global application to all releant lubridate functions in a session. |
Just to chime in, I'd like this too. When needed one can rearrange wday levels with something like this
but a general option would be nice. |
Also, would it make sense to take week start based on the locale Also this has been a feature request for two years now... no takers? |
I am not a big fan of locale-dependent settings as the same code will produce different results for different people. But given that in this regard to core R and some parts in lubridate (locale dependent parsing) are already locale dependent it might make sense to have week start locale dependent as well. But I am afraid this would break backward compatibility quite badly. |
One problem I have with locale-dependent settings is that I do work for customers in multiple locales. So sometimes I deliver output that has the first day Sunday, other times Monday. And that does not depend on my locale, but my customers'. Instead maybe something that could be in |
I'm currently using floor_date() extensively for a project and happen to need it to collapse on Saturday which is obviously not typical but would be nice to have the option to do. Something like floor_date(data$date, weekstart = 'Saturday') |
You can do this with |
That doesn't change the actual week, just how its labeled. To actually shift the window I use |
Hello everybody, I am also interested in this feature. In many asset pricing studies, one can use different week-cycles (say Monday to Monday, or Friday to Friday, or even Wed to Wed). It would be nice to have that directly in |
See here for other people struggling with that https://stackoverflow.com/questions/40554231/dplyr-how-to-aggregate-a-dataframe-by-week?noredirect=1#40554306 |
One can always code it manually, but I think |
Given that the round-functions are gaining a |
This is a good point. Thanks for pointing it out. I made this change. Hesitated a bit because |
It would be useful to have a parameter in the
week()
function to set the initial day for the week. On the USA is common to consider as a starting day for a week Sunday, whereas in Europe we start the week on Monday.The text was updated successfully, but these errors were encountered: