-
Notifications
You must be signed in to change notification settings - Fork 207
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
Add a ym() function for year-month "dates" in spirit of yq()? #630
Comments
I don't think those functions are that useful, especially that the semantics of You can already do such partial parsing in a number of ways: > ymd("2001-01", truncated = 1)
[1] "2001-01-01"
> myd("01-2001", truncated = 1)
[1] "2001-01-01"
> ymd(paste0("2001-01", "-03"))
[1] "2001-01-03"
> parse_date_time("2001-01", "ym")
[1] "2001-01-01 UTC"
> parse_date_time2("2001-01", "Ym")
[1] "2001-01-01 UTC" For day part one can do |
I could use this function as well. |
I was looking for this function today. Seems like all possible combinations of dates should be covered to make the library universally useful. |
+1 in favor of this function. Writing out ugly solutions like |
Just tossing my vote for support on this as well. Currently looking for an elegant way to incrementally increase MY and it's a bit of a pain to try to keep it clean and consistent with the other code utilizing Lubridate. |
This is a really common use case at our work and would be a great add =) |
+1 in favor of this feature request |
Seems like dates <- as.Date(c("2019-01-01", "2019-02-20"))
floor_date(dates, "month") Admittedly you get dates on the first of each month and not dates with no day component, but from that point on you can use all the standard Lubridate functions to add or subtract months. |
Would also appreciate this feature, the workarounds are far less intuitive. |
I will add it soonish. |
same here |
@vspinu Any update on this? Is there a timeline for "soonish" ;-) |
This would be a great function to have. |
This would be good |
Adding my vote as well ! |
And my vote! |
+1 |
I would also like to see this function! |
+1 |
1 similar comment
+1 |
Looking forward to this function +1 |
+1 |
1 similar comment
+1 |
Reopening due to a popular request. |
+1 |
1 similar comment
+1 |
This feature is long on CRAN. Locking. |
As lubridate already has a handy
yq()
function for parsing year-quarter "dates", would you consider addingym()
, the equivalent for numeric year-month "dates"?Date such as this crop up all the time in applied sciences, where the exact date of sampling is not recorded or neccessary or the data have been aggregated to a monthly time step, eg monthly climate anomolies, and provided in that format (i.e. without any day component).
parse_date_time
knows how to handle such inputsI'm thinking of something along the lines of (I'm new to lubridate so I'm not sure I follow the meaning of the
orders
argument just yet):with expected output
Optionally, accepting an argument
fraction
(or equivalent) would allow user to control the day part that is added: would returndate + days(fraction * days_in_month)
?The text was updated successfully, but these errors were encountered: