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 x and y. These are used in error messages to inform the user about the locations of incompatible types (see stop_incompatible_type()).

Details

Coercion rules for jdate and jdatetime:

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]