Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian Chan committed Aug 20, 2024
1 parent 49e242e commit 00a5b28
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions R/write.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion man/xportr_write.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions tests/testthat/test-write.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))
)
})

Expand Down

0 comments on commit 00a5b28

Please sign in to comment.