Comments (18)
In particular, this means that settors should retain the class of the original object.
from lubridate.
major date time classes so far identified: Date, POSIXct, POSIXlt, timeDate, yearmon, yearqtr, zoo, timeSeries, ts, irts, fts, its, difftime
from lubridate.
Sounds like a good list.
from lubridate.
note to self: perhaps create a is.date.object() to recognize all date formats (POSIXct, POSIXt, Date, etc.) then use as.POSIXct() to put them all into one format to operate on.
Will also have to add "+.Date" etc. to the top line
from lubridate.
How should we handle this?
This code returns the same class for a settor
"second<-" <- function(x, value) {
date <- as.POSIXlt(x) - (second(x) - value)
f <- match.fun(paste("as", class(x), sep = "."))
f(date)
}
If the class does not support seconds, then "seconds<-"(x) just returns x. Do we prefer this? Or do we want to change x to a class that supports seconds (POSIXt)? Or do we want to make this an option with no change as the default?
from lubridate.
Should ymd() recognize that 14448 is "2009-07-23" in Date format (i.e. class = "Date")?
from lubridate.
"second<-" <- function(x, value) UseMethod("second")
"second<-.default" <- function(x, value) as.POSIXlt(x) - (second(x) - value)
And no ymd() should not recognise 14448 as a date.
from lubridate.
accessors now work for chron objects
I rewrote hour(x) so it returns the hour in the time zone that x is displayed in (otherwise, hour(x) would not equal the hour you see displayed on the screen for chron objects).
I made tz(x) return "GMT" for chron objects since chrons do not support timezones, but R treats them as if they have a timezone = "GMT" by default.
from lubridate.
accessors now work for zoo objects
from lubridate.
accessors now work for zooreg, yearmon, and yearqtr objects
from lubridate.
accessors now work for timeDate objects
from lubridate.
accessors now work for xts objects
from lubridate.
accessors now work for its objects
from lubridate.
difftime is not a date time object
from lubridate.
accessors now work as much as I think they're going to with ti objects from the tis package. That package shares the same function names as ours. Also, in its documentation it states the things it tries to do don't always work (see hms() documentation).
from lubridate.
accessors now work for timeSeries objects
from lubridate.
accessors now work for fts objects
from lubridate.
ts objects do not use a recognized date format. I'm not sure if I should write code to decipher them. Or if there would be any point, because if users want that sort of specificity they should use one of the above classes and not a ts class.
from lubridate.
Related Issues (20)
- as_datetime() HOT 1
- Problems with POSIXct in R 4.3.2 HOT 1
- 'OO' format option not recognized for parsing ISO 8601 time zone offsets
- `parse_date_time()` cannot match missing zeroes
- Inconsistent behavior of `parse_date_time()` inside `dplyr::mutate()` HOT 2
- month() and otehrs fail on objects from class 'timeDate'
- ymd_hms() function left-pads some dates that have missing "seconds" values
- round_date in 0.1 sec doesn't work correctly
- FR: int_overlaps with exclusive endpoints
- unique() always zero for periods HOT 1
- Implement Set Operations methods for Dates
- Parsing dates with `my` seems to have a limit size
- Do we need something like `%m-%` to subtract years from leap 02/29? HOT 1
- Cannot compute `<date> + lubridate::year(1)` when `<date>` is a leap day. HOT 1
- m:s:ms time data
- `dmy()` not failing (and returning incorrect date) on wrong date format
- ceiling_date() issue when using multi units
- Fractional Seconds with conversion and rounding/truncation?
- mdy("04 July 2019") GIVES "2019-04-20" : Instead should give an error.
- data.table merge doesn't work with intervals
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lubridate.