From 00a5b28c7f669193965599993696e2e40f18c04d Mon Sep 17 00:00:00 2001 From: Adrian Chan Date: Tue, 20 Aug 2024 14:19:53 +0000 Subject: [PATCH] updates --- NEWS.md | 2 +- R/write.R | 6 +++--- man/xportr_write.Rd | 2 +- tests/testthat/test-write.R | 10 +++++----- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/NEWS.md b/NEWS.md index b82cf657..3b93a7df 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,7 +2,7 @@ ## xportr development version -* New argument in `xportr_write()` allows users to specify the maximum file size (in gb) of their exported xpt files. (#268) +* New argument in `xportr_write()` allows users to specify the maximum file size (in GB) of their exported xpt files. (#268) ## New Features diff --git a/R/write.R b/R/write.R index c8cebd25..bc1387ba 100644 --- a/R/write.R +++ b/R/write.R @@ -7,7 +7,7 @@ #' @param .df A data frame to write. #' @param path Path where transport file will be written. File name sans will be #' used as `xpt` name. -#' @param max_size_gb Maximum size in gb of the exported files +#' @param max_size_gb Maximum size in GB of the exported files. #' @param label `r lifecycle::badge("deprecated")` Previously used to to set the Dataset label. #' Use the `metadata` argument to set the dataset label. #' @param strict_checks If TRUE, xpt validation will report errors and not write @@ -151,8 +151,8 @@ get_split_path <- function(path, ind) { #' Function to export data frame to xpt files ensuring each file does not exceed the maximum specified size in GB #' #' @param df A data frame to write. -#' @param max_size_gb Maximum size in gb of the exported files -#' @param file_prefix Name of each exported file +#' @param max_size_gb Maximum size in GB of the exported files. +#' @param file_prefix Name of each exported file. #' #' @noRd diff --git a/man/xportr_write.Rd b/man/xportr_write.Rd index 0bb85700..58dff195 100644 --- a/man/xportr_write.Rd +++ b/man/xportr_write.Rd @@ -20,7 +20,7 @@ xportr_write( \item{path}{Path where transport file will be written. File name sans will be used as \code{xpt} name.} -\item{max_size_gb}{Maximum size in gb of the exported files} +\item{max_size_gb}{Maximum size in GB of the exported files.} \item{metadata}{A data frame containing dataset. See 'Metadata' section for details.} diff --git a/tests/testthat/test-write.R b/tests/testthat/test-write.R index 54835bc5..aad9e69e 100644 --- a/tests/testthat/test-write.R +++ b/tests/testthat/test-write.R @@ -230,27 +230,27 @@ test_that("write Test 14: `max_size_gb` is used to split data frame into specifi expect_true( file.exists(file.path(tmpdir, "adlb1.xpt")), - file.info(file.path(tmpdir, "adlb1.xpt"))$size <= as.numeric(format(max_size_gb * 10^9, scientific = F)) + file.info(file.path(tmpdir, "adlb1.xpt"))$size <= as.numeric(format(max_size_gb * 10^9, scientific = FALSE)) ) expect_true( file.exists(file.path(tmpdir, "adlb2.xpt")), - file.info(file.path(tmpdir, "adlb2.xpt"))$size <= as.numeric(format(max_size_gb * 10^9, scientific = F)) + file.info(file.path(tmpdir, "adlb2.xpt"))$size <= as.numeric(format(max_size_gb * 10^9, scientific = FALSE)) ) expect_true( file.exists(file.path(tmpdir, "adlb3.xpt")), - file.info(file.path(tmpdir, "adlb3.xpt"))$size <= as.numeric(format(max_size_gb * 10^9, scientific = F)) + file.info(file.path(tmpdir, "adlb3.xpt"))$size <= as.numeric(format(max_size_gb * 10^9, scientific = FALSE)) ) expect_true( file.exists(file.path(tmpdir, "adlb4.xpt")), - file.info(file.path(tmpdir, "adlb4.xpt"))$size <= as.numeric(format(max_size_gb * 10^9, scientific = F)) + file.info(file.path(tmpdir, "adlb4.xpt"))$size <= as.numeric(format(max_size_gb * 10^9, scientific = FALSE)) ) expect_true( file.exists(file.path(tmpdir, "adlb5.xpt")), - file.info(file.path(tmpdir, "adlb5.xpt"))$size <= as.numeric(format(max_size_gb * 10^9, scientific = F)) + file.info(file.path(tmpdir, "adlb5.xpt"))$size <= as.numeric(format(max_size_gb * 10^9, scientific = FALSE)) ) })