Skip to content

Commit 74ddb55

Browse files
Fix method registration of cast methods
1 parent 46a46ce commit 74ddb55

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

NAMESPACE

+5-4
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@ S3method(select,vitae_preserve)
1818
S3method(slice,vitae_preserve)
1919
S3method(summarise,vitae_preserve)
2020
S3method(transmute,vitae_preserve)
21+
S3method(vec_cast.character,csl_date)
22+
S3method(vec_cast.character,csl_name)
23+
S3method(vec_cast.double,csl_date)
2124
S3method(vec_proxy_order,csl_date)
2225
S3method(vec_proxy_order,csl_name)
26+
S3method(vec_ptype2.double,csl_date)
2327
S3method(vec_ptype_abbr,csl_date)
2428
S3method(vec_ptype_abbr,csl_name)
2529
S3method(xtfrm,csl_date)
@@ -46,12 +50,9 @@ export(slice)
4650
export(summarise)
4751
export(transmute)
4852
export(twentyseconds)
49-
export(vec_cast.character.csl_date)
50-
export(vec_cast.character.csl_name)
51-
export(vec_cast.double.csl_date)
5253
export(vec_ptype2.csl_date.double)
53-
export(vec_ptype2.double.csl_date)
5454
import(glue)
55+
import(vctrs)
5556
importFrom(dplyr,"%>%")
5657
importFrom(dplyr,arrange)
5758
importFrom(dplyr,distinct)

R/csl_types.R

+4
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ format.csl_name <- function(x, ...) {
4444
#' @export
4545
vec_ptype_abbr.csl_name <- function(x) "csl name"
4646

47+
#' @method vec_cast.character csl_name
4748
#' @export
4849
vec_cast.character.csl_name <- function(x, to, ...) {
4950
format(x)
@@ -97,13 +98,16 @@ vec_ptype_abbr.csl_date <- function(x) "csl_date"
9798
vec_ptype2.csl_date.double <- function(x, y, ...) {
9899
double()
99100
}
101+
#' @method vec_ptype2.double csl_date
100102
#' @export
101103
vec_ptype2.double.csl_date <- vec_ptype2.csl_date.double
102104

105+
#' @method vec_cast.double csl_date
103106
#' @export
104107
vec_cast.double.csl_date <- function(x, to, ...) {
105108
vapply(x, function(x) if(is.null(x)) NA_real_ else x[[1]][[1]], numeric(1L))
106109
}
110+
#' @method vec_cast.character csl_date
107111
#' @export
108112
vec_cast.character.csl_date <- function(x, to, ...) {
109113
format(x)

R/vitae-package.R

+4
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
#' @keywords internal
22
"_PACKAGE"
3+
4+
5+
#' @import vctrs
6+
NULL

0 commit comments

Comments
 (0)