-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* add in split function * Add tests and functionality * Testing and doc updates * Update tests to correct skip condition and add cli_warn * Update with lint and style * exclude large file size from cov * Update R/split.R Co-authored-by: Ben Straub <ben.x.straub@gsk.com> * Update R/split.R Co-authored-by: Ben Straub <ben.x.straub@gsk.com> * Update R/write.R Co-authored-by: Ben Straub <ben.x.straub@gsk.com> * Update for passing R CMD Check * Update R/split.R --------- Co-authored-by: Ben Straub <ben.x.straub@gsk.com>
- Loading branch information
1 parent
c5468df
commit 63c52b1
Showing
11 changed files
with
209 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#' Split xpt file output | ||
#' | ||
#' Per the FDA Study Data Technical Conformance | ||
#' Guide(https://www.fda.gov/media/88173/download) section 3.3.2, dataset files | ||
#' sizes shouldn't exceed 5 GB. If datasets are large enough, they should be | ||
#' split based on a variable. For example, laboratory readings in `ADLB` can be | ||
#' split by `LBCAT` to split up hematology and chemistry data. | ||
#' | ||
#' This function will tell `xportr_write()` to split the data frame based on the | ||
#' variable passed in `split_by`. When written, the file name will be prepended | ||
#' with a number for uniqueness. These files should be noted in the Reviewer Guides per | ||
#' CDISC guidance to note how you split your files. | ||
#' | ||
#' @inheritParams xportr_length | ||
#' @param split_by A quoted variable that will be passed to `base::split()`. | ||
#' | ||
#' @return A data frame with an additional attribute added so `xportr_write()` | ||
#' knows how to split the data frame. | ||
#' | ||
#' | ||
#' @export | ||
#' | ||
#' @examples | ||
#' | ||
#' adlb <- data.frame( | ||
#' USUBJID = c(1001, 1002, 1003), | ||
#' LBCAT = c("HEMATOLOGY", "HEMATOLOGY", "CHEMISTRY") | ||
#' ) | ||
#' | ||
#' adsl <- xportr_split(adsl, "LBCAT") | ||
xportr_split <- function(.df, split_by = NULL) { | ||
attr(.df, "_xportr.split_by_") <- split_by | ||
|
||
return(.df) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters