Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign up`duration` ignores class of first argument #462
Comments
|
I thought the result is transferred to the specified |
|
Yes. It should be disallowed. For conversion use |
|
Thank you. Perhaps you can add a comment somewhere that for conversion you I could not find it in the descrition nor in the article "Dates and Times |
|
Hm. I am starting thinking this was a mistake. There might be plenty of derived classes from numeric that are valid inputs into I am replacing this change with a much weaker check for "Period" and "Interval" class. |
Not anymore in the development version of lubridate. |
See🔗 Stack Overflow question.
In a nutshell, the following code
Yields an unexpected output for the last line because the class of
five_secis ignored, and its unit is overridden to be interpreted asdays. This makes sense for a unitlessnumargument — butfive_secisn’t unitless by virtue of being anInterval.The expected behaviour is that this should be disallowed — i.e. throw an error, or at least signal a stern warning that the interval’s unit is being ignored.