From d393a8a08d653071fa27e2b67260a27da191bb59 Mon Sep 17 00:00:00 2001 From: Emil Hvitfeldt Date: Wed, 10 Jan 2024 11:11:51 -0800 Subject: [PATCH] adding pretty method to validation_set --- NAMESPACE | 1 + R/printing.R | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/NAMESPACE b/NAMESPACE index 21e15dc3..19772f54 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -53,6 +53,7 @@ S3method(pretty,rolling_origin) S3method(pretty,sliding_index) S3method(pretty,sliding_period) S3method(pretty,sliding_window) +S3method(pretty,validation_set) S3method(pretty,validation_split) S3method(pretty,vfold_cv) S3method(print,apparent) diff --git a/R/printing.R b/R/printing.R index af3646ae..9a37254f 100644 --- a/R/printing.R +++ b/R/printing.R @@ -63,6 +63,19 @@ pretty.mc_cv <- function(x, ...) { res } +#' @export +pretty.validation_set <- function(x, ...) { + details <- attributes(x) + res <- paste0( + "Validation Set (", + signif(details$prop[1] / sum(details$prop), 2), + "/", + signif(details$prop[2] / sum(details$prop), 2), + ")" + ) + res +} + #' @export pretty.validation_split <- function(x, ...) { details <- attributes(x)