-
Notifications
You must be signed in to change notification settings - Fork 29
Closed
Description
Something like this:
library(vctrs)
vec_cast.hms <- function(x, to) UseMethod("vec_cast.hms")
vec_cast.hms.default <- function(x, to) stop_incompatible_cast(x, to)
vec_cast.hms.logical <- function(x, to) vec_unspecified_cast(x, to)
vec_cast.hms.hms <- function(x, to) x
vec_cast.hms.difftime <- function(x, to) hms::as.hms(x)
vec_cast.difftime.hms <- function(x, to) as.difftime(x)
vec_type2.hms <- function(x, y) UseMethod("vec_type2.hms")
vec_type2.hms.default <- function(x, y) stop_incompatible_type(x, y)
vec_type2.hms.vctrs_unspecified <- function(x, y) x
vec_type2.hms.vctrs_percent <- function(x, y) x
vec_type2.hms.hms <- function(x, y) hms::hms()
vec_type2.difftime.hms <- function(x, y) new_difftime(units = units(x))
vec_type2.hms.difftime <- function(x, y) new_difftime(units = units(y))
library(hms)
time <- hms(5)
vec_c(time, time + 0:10 * 900)
#> 00:00:05
#> 00:00:05
#> 00:15:05
#> 00:30:05
#> 00:45:05
#> 01:00:05
#> 01:15:05
#> 01:30:05
#> 01:45:05
#> 02:00:05
#> 02:15:05
#> 02:30:05Created on 2018-10-30 by the reprex package (v0.2.1)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels