Skip to content

Commit

Permalink
updates to fix cmd checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian Chan committed Aug 20, 2024
1 parent c47bbbd commit 49e242e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 11 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Suggests:
knitr,
labelled,
metacore,
pharmaverseadam,
readxl,
rmarkdown,
testthat (>= 3.0.0),
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# xportr 0.4.0

## 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 Features

* All core functions can be run together by using new function `xportr()` (#137)
Expand Down
2 changes: 1 addition & 1 deletion R/write.R
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export_to_xpt <- function(.df, path, max_size_gb, file_prefix) {
high <- mid - 1
}

unlink(temp_file) # Clean up the temporary file
unlink(temp_file) # Clean up the temporary file
}

# Write the best fitting chunk to the final file
Expand Down
3 changes: 3 additions & 0 deletions man/xportr_write.Rd

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

20 changes: 10 additions & 10 deletions tests/testthat/test-write.R
Original file line number Diff line number Diff line change
Expand Up @@ -214,19 +214,19 @@ test_that("write Test 13: Capture errors by haven and report them as such", {

## Test 14: xportr_write: `max_size_gb` is used to split data frame into specified maximum file size ----
test_that("write Test 14: `max_size_gb` is used to split data frame into specified maximum file size", {
adlb <- pharmaverseadam::adlb
adlb <- pharmaverseadam::adlb

tmpdir <- tempdir()
tmpdir <- tempdir()

#20 mb
max_size_gb <- 20 / 1000
# 20 mb
max_size_gb <- 20 / 1000

xportr_write(adlb,
path = paste0(tmpdir, "/adlb.xpt"),
domain = "adlb",
max_size_gb = max_size_gb,
strict_checks = FALSE
)
xportr_write(adlb,
path = paste0(tmpdir, "/adlb.xpt"),
domain = "adlb",
max_size_gb = max_size_gb,
strict_checks = FALSE
)

expect_true(
file.exists(file.path(tmpdir, "adlb1.xpt")),
Expand Down

0 comments on commit 49e242e

Please sign in to comment.