From ea6b419cb1d9b3e24c6ebd44173320a0e7a33ccf Mon Sep 17 00:00:00 2001 From: olivroy Date: Thu, 2 Nov 2023 16:07:46 -0400 Subject: [PATCH] Make gtsave return file path invisibly. --- NEWS.md | 2 ++ R/export.R | 7 +++++-- man/gtsave.Rd | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/NEWS.md b/NEWS.md index f57ddf849f..c799a5237b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,8 @@ * The performance of rendering bigger tables as HTML has been improved and is now up to 3 times faster than before (@mgirlich, #1470). +* `gtsave()` now returns the file path invisibly instead of `TRUE` (@olivroy, #1478). + # gt 0.10.0 ## Nanoplots diff --git a/R/export.R b/R/export.R index 1abd2f13b5..68563f9328 100644 --- a/R/export.R +++ b/R/export.R @@ -97,7 +97,7 @@ #' #' All other options passed to the appropriate internal saving function. #' -#' @return Invisibly returns `TRUE` if the export process is successful. +#' @return The file name (invisibly) if the export process is successful. #' #' @section Examples: #' @@ -217,8 +217,11 @@ gtsave <- function( )) } ) + if (!is.null(path)) { + filename <- file.path(path, filename) + } - invisible(TRUE) + invisible(filename) } #' Saving function for an HTML file diff --git a/man/gtsave.Rd b/man/gtsave.Rd index 35c2781134..a851236378 100644 --- a/man/gtsave.Rd +++ b/man/gtsave.Rd @@ -36,7 +36,7 @@ An optional path to which the file should be saved (combined with All other options passed to the appropriate internal saving function.} } \value{ -Invisibly returns \code{TRUE} if the export process is successful. +The file name (invisibly) if the export process is successful. } \description{ The \code{gtsave()} function makes it easy to save a \strong{gt} table to a file. The