mirror of
https://github.com/msberends/AMR.git
synced 2025-01-13 17:31:38 +01:00
vctrs fix
This commit is contained in:
parent
4aa5413641
commit
35963ca3dc
@ -1,5 +1,5 @@
|
|||||||
Package: AMR
|
Package: AMR
|
||||||
Version: 2.1.1.9007
|
Version: 2.1.1.9008
|
||||||
Date: 2024-02-24
|
Date: 2024-02-24
|
||||||
Title: Antimicrobial Resistance Data Analysis
|
Title: Antimicrobial Resistance Data Analysis
|
||||||
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
|
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
|
||||||
|
2
NEWS.md
2
NEWS.md
@ -1,4 +1,4 @@
|
|||||||
# AMR 2.1.1.9007
|
# AMR 2.1.1.9008
|
||||||
|
|
||||||
*(this beta version will eventually become v3.0. We're happy to reach a new major milestone soon, which will be all about the new One Health support!)*
|
*(this beta version will eventually become v3.0. We're happy to reach a new major milestone soon, which will be all about the new One Health support!)*
|
||||||
|
|
||||||
|
30
R/vctrs.R
30
R/vctrs.R
@ -34,29 +34,31 @@
|
|||||||
|
|
||||||
# see https://github.com/tidyverse/dplyr/issues/5955 why this is required
|
# see https://github.com/tidyverse/dplyr/issues/5955 why this is required
|
||||||
|
|
||||||
# S3: ab_selector
|
# S3: ab_selector ----
|
||||||
vec_ptype2.ab_selector.default <- function (x, y, ..., x_arg = "", y_arg = "") {
|
# this does not need a .default method since it's used internally only
|
||||||
|
vec_ptype2.character.ab_selector <- function(x, y, ...) {
|
||||||
x
|
x
|
||||||
}
|
}
|
||||||
vec_ptype2.ab_selector.ab_selector <- function(x, y, ...) {
|
vec_ptype2.ab_selector.character <- function(x, y, ...) {
|
||||||
x
|
y
|
||||||
}
|
}
|
||||||
vec_cast.character.ab_selector <- function(x, to, ...) {
|
vec_cast.character.ab_selector <- function(x, to, ...) {
|
||||||
unclass(x)
|
unclass(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
# S3: ab_selector_any_all
|
# S3: ab_selector_any_all ----
|
||||||
vec_ptype2.ab_selector_any_all.default <- function (x, y, ..., x_arg = "", y_arg = "") {
|
# this does not need a .default method since it's used internally only
|
||||||
|
vec_ptype2.logical.ab_selector_any_all <- function(x, y, ...) {
|
||||||
x
|
x
|
||||||
}
|
}
|
||||||
vec_ptype2.ab_selector_any_all.ab_selector_any_all <- function(x, y, ...) {
|
vec_ptype2.ab_selector_any_all.logical <- function(x, y, ...) {
|
||||||
x
|
y
|
||||||
}
|
}
|
||||||
vec_cast.logical.ab_selector_any_all <- function(x, to, ...) {
|
vec_cast.logical.ab_selector_any_all <- function(x, to, ...) {
|
||||||
unclass(x)
|
unclass(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
# S3: ab
|
# S3: ab ----
|
||||||
vec_ptype2.ab.default <- function (x, y, ..., x_arg = "", y_arg = "") {
|
vec_ptype2.ab.default <- function (x, y, ..., x_arg = "", y_arg = "") {
|
||||||
x
|
x
|
||||||
}
|
}
|
||||||
@ -70,7 +72,7 @@ vec_cast.ab.character <- function(x, to, ...) {
|
|||||||
return_after_integrity_check(x, "antimicrobial drug code", as.character(AMR_env$AB_lookup$ab))
|
return_after_integrity_check(x, "antimicrobial drug code", as.character(AMR_env$AB_lookup$ab))
|
||||||
}
|
}
|
||||||
|
|
||||||
# S3: av
|
# S3: av ----
|
||||||
vec_ptype2.av.default <- function (x, y, ..., x_arg = "", y_arg = "") {
|
vec_ptype2.av.default <- function (x, y, ..., x_arg = "", y_arg = "") {
|
||||||
x
|
x
|
||||||
}
|
}
|
||||||
@ -84,7 +86,7 @@ vec_cast.av.character <- function(x, to, ...) {
|
|||||||
return_after_integrity_check(x, "antiviral drug code", as.character(AMR_env$AV_lookup$av))
|
return_after_integrity_check(x, "antiviral drug code", as.character(AMR_env$AV_lookup$av))
|
||||||
}
|
}
|
||||||
|
|
||||||
# S3: mo
|
# S3: mo ----
|
||||||
vec_ptype2.mo.default <- function (x, y, ..., x_arg = "", y_arg = "") {
|
vec_ptype2.mo.default <- function (x, y, ..., x_arg = "", y_arg = "") {
|
||||||
x
|
x
|
||||||
}
|
}
|
||||||
@ -99,7 +101,7 @@ vec_cast.mo.character <- function(x, to, ...) {
|
|||||||
return_after_integrity_check(x, "microorganism code", as.character(AMR_env$MO_lookup$mo))
|
return_after_integrity_check(x, "microorganism code", as.character(AMR_env$MO_lookup$mo))
|
||||||
}
|
}
|
||||||
|
|
||||||
# S3: disk
|
# S3: disk ----
|
||||||
vec_ptype2.disk.default <- function (x, y, ..., x_arg = "", y_arg = "") {
|
vec_ptype2.disk.default <- function (x, y, ..., x_arg = "", y_arg = "") {
|
||||||
x
|
x
|
||||||
}
|
}
|
||||||
@ -125,7 +127,7 @@ vec_cast.disk.character <- function(x, to, ...) {
|
|||||||
as.disk(x)
|
as.disk(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
# S3: mic
|
# S3: mic ----
|
||||||
vec_ptype2.mic.default <- function (x, y, ..., x_arg = "", y_arg = "") {
|
vec_ptype2.mic.default <- function (x, y, ..., x_arg = "", y_arg = "") {
|
||||||
x
|
x
|
||||||
}
|
}
|
||||||
@ -157,7 +159,7 @@ vec_arith.mic <- function(op, x, y, ...) {
|
|||||||
vctrs::vec_arith(op, as.double(x), as.double(y))
|
vctrs::vec_arith(op, as.double(x), as.double(y))
|
||||||
}
|
}
|
||||||
|
|
||||||
# S3: sir
|
# S3: sir ----
|
||||||
vec_ptype2.sir.default <- function (x, y, ..., x_arg = "", y_arg = "") {
|
vec_ptype2.sir.default <- function (x, y, ..., x_arg = "", y_arg = "") {
|
||||||
x
|
x
|
||||||
}
|
}
|
||||||
|
8
R/zzz.R
8
R/zzz.R
@ -133,12 +133,12 @@ if (pkg_is_available("cli")) {
|
|||||||
# Support vctrs package for use in e.g. dplyr verbs
|
# Support vctrs package for use in e.g. dplyr verbs
|
||||||
# NOTE 2024-02-22 this is the right way - it should be 2 S3 classes in the second argument
|
# NOTE 2024-02-22 this is the right way - it should be 2 S3 classes in the second argument
|
||||||
# S3: ab_selector
|
# S3: ab_selector
|
||||||
s3_register("vctrs::vec_ptype2", "ab_selector.default")
|
s3_register("vctrs::vec_ptype2", "character.ab_selector")
|
||||||
s3_register("vctrs::vec_ptype2", "ab_selector.ab_selector")
|
s3_register("vctrs::vec_ptype2", "ab_selector.character")
|
||||||
s3_register("vctrs::vec_cast", "character.ab_selector")
|
s3_register("vctrs::vec_cast", "character.ab_selector")
|
||||||
# S3: ab_selector_any_all
|
# S3: ab_selector_any_all
|
||||||
s3_register("vctrs::vec_ptype2", "ab_selector_any_all.default")
|
s3_register("vctrs::vec_ptype2", "logical.ab_selector_any_all")
|
||||||
s3_register("vctrs::vec_ptype2", "ab_selector_any_all.ab_selector_any_all")
|
s3_register("vctrs::vec_ptype2", "ab_selector_any_all.logical")
|
||||||
s3_register("vctrs::vec_cast", "logical.ab_selector_any_all")
|
s3_register("vctrs::vec_cast", "logical.ab_selector_any_all")
|
||||||
# S3: ab
|
# S3: ab
|
||||||
s3_register("vctrs::vec_ptype2", "ab.default")
|
s3_register("vctrs::vec_ptype2", "ab.default")
|
||||||
|
Loading…
Reference in New Issue
Block a user