shide-coercion {shide} | R Documentation |
Coercion
Description
Double dispatch methods to support vctrs::vec_ptype2()
.
Usage
## S3 method for class 'jdate'
vec_ptype2(x, y, ..., x_arg = "", y_arg = "")
## S3 method for class 'jdatetime'
vec_ptype2(x, y, ..., x_arg = "", y_arg = "")
Arguments
x , y |
Vector types. |
... |
These dots are for future extensions and must be empty. |
x_arg , y_arg |
Argument names for |
Details
Coercion rules for jdate
and jdatetime
:
Combining a
jdate
andjdatetime
yields ajdatetime
.When combining two
jdatetime
objects, the timezone is taken from the first non-local timezone.
Value
An object prototype if x and y can be safely coerced to the same prototype;
otherwise it returns an error. See details for more information on
coercion hierarchy for jdate
and jdatetime
.
Examples
# jdate and jdatetime are compatible
c(jdate(), jdatetime(), jdatetime(tzone = "UTC"))
# jdate and Date are incompatible
try(c(jdate(), as.Date(NULL)))
[Package shide version 0.2.1 Index]