diff --git a/NAMESPACE b/NAMESPACE index 48b1a5ac..c15d7855 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -18,8 +18,13 @@ S3method(select,vitae_preserve) S3method(slice,vitae_preserve) S3method(summarise,vitae_preserve) S3method(transmute,vitae_preserve) +S3method(vec_cast.character,csl_date) +S3method(vec_cast.character,csl_name) +S3method(vec_cast.double,csl_date) S3method(vec_proxy_order,csl_date) S3method(vec_proxy_order,csl_name) +S3method(vec_ptype2,csl_date.double) +S3method(vec_ptype2.double,csl_date) S3method(vec_ptype_abbr,csl_date) S3method(vec_ptype_abbr,csl_name) S3method(xtfrm,csl_date) @@ -46,12 +51,8 @@ export(slice) export(summarise) export(transmute) export(twentyseconds) -export(vec_cast.character.csl_date) -export(vec_cast.character.csl_name) -export(vec_cast.double.csl_date) -export(vec_ptype2.csl_date.double) -export(vec_ptype2.double.csl_date) import(glue) +import(vctrs) importFrom(dplyr,"%>%") importFrom(dplyr,arrange) importFrom(dplyr,distinct) diff --git a/R/csl_types.R b/R/csl_types.R index 4946af21..c8d15c69 100644 --- a/R/csl_types.R +++ b/R/csl_types.R @@ -44,6 +44,7 @@ format.csl_name <- function(x, ...) { #' @export vec_ptype_abbr.csl_name <- function(x) "csl name" +#' @method vec_cast.character csl_name #' @export vec_cast.character.csl_name <- function(x, to, ...) { format(x) @@ -97,13 +98,16 @@ vec_ptype_abbr.csl_date <- function(x) "csl_date" vec_ptype2.csl_date.double <- function(x, y, ...) { double() } +#' @method vec_ptype2.double csl_date #' @export vec_ptype2.double.csl_date <- vec_ptype2.csl_date.double +#' @method vec_cast.double csl_date #' @export vec_cast.double.csl_date <- function(x, to, ...) { vapply(x, function(x) if(is.null(x)) NA_real_ else x[[1]][[1]], numeric(1L)) } +#' @method vec_cast.character csl_date #' @export vec_cast.character.csl_date <- function(x, to, ...) { format(x) diff --git a/R/vitae-package.R b/R/vitae-package.R index 0cc9debe..a5db75f8 100644 --- a/R/vitae-package.R +++ b/R/vitae-package.R @@ -1,2 +1,6 @@ #' @keywords internal "_PACKAGE" + + +#' @import vctrs +NULL