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
ps_create_datetime, ps_create_date? #2
Comments
I like my only suggestions are that it should be
An interesting idea is if for example |
I wonder if there should be two functions for datetime.
Seems to me that these are the two most likely scenarios |
This opens a whole can of worms as datetimes can come in so many formats, but if we can capture the most common... |
An elegant solutions seems to be to just have the one constructor function based on year, month, day, hour, minute, second etc plus a generic deconstruction function that takes a single data/time object and decomposes it into Year, Month, Day or whatever makes sense. The user can then break apart and put back together as they see fit. The only trick thing is what to do about the tz. We could add this to a column as well. Thoughts? |
I like the idea. I also like the construct verb better than create. Could the deconstruction function just deal with character instead of date/time?...that way tz only comes in once the construction happens. |
I think the question of how to go from a character to a date time is different to the question of how to decompose a datetime (which is useful for combining) versus how to construct a date time from year, month, day etc. The character to date time functions in lubridate are well developed so may handle this problem? |
yes the lubridate functions are very good and no need to reinvent the wheel. If there is a character Date and Time column it probably just makes most sense to do I think constructing from year, month, day, hour, minute, second is still useful though. perhaps there could be an option in |
yes I think the tz argument which could be NULL by default indicating don't create when deconstructing is the best solution. also the deconstruction function should include year = "Year" etc to allow the user to name each of the name columns or in the case of year = NULL to not construct at all. |
also it might be worth having the arguments suffix = "" and prefix = "" which as character scalars allow the user to quickly change all the column from the default of Year, Month, Day, etc to SiteYear, SiteMonth, SiteDay simply by setting suffix = "Site" |
yes great ideas. Do you want me to try to take this one on? The function seems to be almost done. |
yes please |
what is the best way to allow both a column name or an integer?:
|
|
|
OK that's great, but then what is best way to take a combination of integer and column names and paste into a format that lubridate::ymd_hms can read? |
if |
note |
opposite of
ps_separate_date/datetime
Takes a vector of column names to create POSIXct or Date, assign tz, convert tz, automatically remove columns used to create datetime/date
something like:
The text was updated successfully, but these errors were encountered: