From 5d750fe01e239c261b7762589e8ac3fb8af7ad58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Tue, 30 Mar 2021 06:51:59 +0200 Subject: [PATCH 1/2] Fix formatting for Surv and Surv2 columns --- R/shaft-.R | 9 +++++++-- R/zzz.R | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/R/shaft-.R b/R/shaft-.R index 1f4a6f5d6..0290dd433 100644 --- a/R/shaft-.R +++ b/R/shaft-.R @@ -164,8 +164,13 @@ pillar_shaft.Surv <- function(x, ...) { } # registered in .onLoad() -pillar_shaft.Surv2 <- function(x, ...) { - new_pillar_shaft_simple(format(x), align = "right") +type_sum.Surv <- function(x) { + "Surv" +} + +# registered in .onLoad() +type_sum.Surv2 <- function(x) { + "Surv2" } #' @export diff --git a/R/zzz.R b/R/zzz.R index fcfd46131..c105c5092 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -21,7 +21,9 @@ NULL register_s3_method("vctrs", "vec_ptype_abbr", "pillar_empty_col") register_s3_method("bit64", "pillar_shaft", "integer64", gen_pkg = "pillar") register_s3_method("survival", "pillar_shaft", "Surv", gen_pkg = "pillar") + register_s3_method("survival", "type_sum", "Surv", gen_pkg = "pillar") register_s3_method("survival", "pillar_shaft", "Surv2", gen_pkg = "pillar") + register_s3_method("survival", "type_sum", "Surv2", gen_pkg = "pillar") assign_crayon_styles() From abb7f154fbd59c68714edc95810a6850320a75ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Tue, 30 Mar 2021 07:06:17 +0200 Subject: [PATCH 2/2] Oops --- R/shaft-.R | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/R/shaft-.R b/R/shaft-.R index 0290dd433..d4d8de423 100644 --- a/R/shaft-.R +++ b/R/shaft-.R @@ -163,6 +163,11 @@ pillar_shaft.Surv <- function(x, ...) { new_pillar_shaft_simple(format(x), align = "right") } +# registered in .onLoad() +pillar_shaft.Surv2 <- function(x, ...) { + new_pillar_shaft_simple(format(x), align = "right") +} + # registered in .onLoad() type_sum.Surv <- function(x) { "Surv"