Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closes #84 xportr deep dive vignette #141

Merged
merged 96 commits into from
Jun 15, 2023
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
819bba9
docs: #84 Example data and spec upload
bms63 May 1, 2023
3132916
docs: #84 ignore folder data and specs stored to pass build
bms63 May 1, 2023
87c2dde
chore: #84 merge in devel
bms63 May 9, 2023
974b6ae
feat: #84 moving to site to bootswatch
bms63 May 11, 2023
d5a2fcf
chore: #84 changed named of spec files. start on deepdive vignette
bms63 May 11, 2023
ea2d744
feat: #84 Laying out Intro sections.
bms63 May 11, 2023
beac75f
update: #122 merge in devel
bms63 May 14, 2023
3f419c1
update: #84 merge in pkgdown update, explain data package, testing ou…
bms63 May 15, 2023
cf19f4d
chore: #44 bringing in new metadata update
bms63 May 20, 2023
a633382
feat: #84 developing deepdive overview section. fixed image in Readme
bms63 May 20, 2023
ef1f903
feat: #84 xportr apply all, new pictogram
bms63 May 21, 2023
9092f25
chore: #84 merge in devel
bms63 May 24, 2023
38d1993
feat: #84 explanding type section
bms63 May 24, 2023
d967bd7
chore: #84 news file updated
bms63 May 24, 2023
9d390bb
chore: fix for index
bms63 May 24, 2023
3a6f3ec
Merge branch 'devel' into 84_xportr_deep_dive_vignette
elimillera May 31, 2023
ebdc579
Move adsl to data/
elimillera May 31, 2023
2b43a7a
Merge remote-tracking branch 'origin/120-replace-metacore-with-metada…
elimillera May 31, 2023
6beb272
Change is null logic
elimillera May 31, 2023
36f188a
remove here
elimillera May 31, 2023
5eddeb8
fix var_spec
elimillera May 31, 2023
5a63b2c
set eval to false
elimillera May 31, 2023
c83e778
Move bulk processing out to issue
elimillera May 31, 2023
4796cb4
Add var_spec documentation.
elimillera May 31, 2023
b25cb4e
Add package style
elimillera May 31, 2023
f8dffd7
docs: #84 fixing display issue for cli in get started, working on war…
bms63 Jun 6, 2023
1f25b30
chore: #84 lintr fix
bms63 Jun 6, 2023
e03ca10
chore: #84 style files
bms63 Jun 6, 2023
6c373e7
docs: #84 finsihing core function examples
bms63 Jun 7, 2023
6d004b8
docs: #84 final touches on functions
bms63 Jun 7, 2023
cb115ac
chore: #84 stler and lintr
bms63 Jun 7, 2023
1af8a61
Update vignettes/deepdive.Rmd
bms63 Jun 8, 2023
e675ca1
Update vignettes/deepdive.Rmd
bms63 Jun 8, 2023
353bb62
Update vignettes/deepdive.Rmd
bms63 Jun 8, 2023
8c051a5
Update vignettes/deepdive.Rmd
bms63 Jun 8, 2023
77577a9
Update vignettes/deepdive.Rmd
bms63 Jun 8, 2023
cda1fd2
Update vignettes/deepdive.Rmd
bms63 Jun 8, 2023
efe8402
Update vignettes/deepdive.Rmd
bms63 Jun 8, 2023
a49ac37
Update vignettes/deepdive.Rmd
bms63 Jun 8, 2023
611cc17
Update vignettes/deepdive.Rmd
bms63 Jun 8, 2023
3383d91
Update vignettes/deepdive.Rmd
bms63 Jun 8, 2023
092120f
Update vignettes/deepdive.Rmd
bms63 Jun 8, 2023
1d23013
Update vignettes/deepdive.Rmd
bms63 Jun 8, 2023
b5566c1
Update vignettes/deepdive.Rmd
bms63 Jun 8, 2023
dc32384
Update vignettes/deepdive.Rmd
bms63 Jun 8, 2023
6f0957d
Update vignettes/deepdive.Rmd
bms63 Jun 8, 2023
92ec2c0
Update vignettes/deepdive.Rmd
bms63 Jun 8, 2023
b99a874
Update vignettes/deepdive.Rmd
bms63 Jun 8, 2023
88ede73
Update vignettes/deepdive.Rmd
bms63 Jun 8, 2023
caf20a0
Update vignettes/deepdive.Rmd
bms63 Jun 8, 2023
91f2b65
Update vignettes/deepdive.Rmd
bms63 Jun 8, 2023
2117b9b
Update vignettes/deepdive.Rmd
bms63 Jun 8, 2023
76d22ba
Update vignettes/deepdive.Rmd
bms63 Jun 8, 2023
c95a690
Update vignettes/deepdive.Rmd
bms63 Jun 8, 2023
e12b51b
Update vignettes/deepdive.Rmd
bms63 Jun 8, 2023
433accb
Update vignettes/deepdive.Rmd
bms63 Jun 8, 2023
848ba3b
Update vignettes/deepdive.Rmd
bms63 Jun 8, 2023
1ab4323
Update vignettes/deepdive.Rmd
bms63 Jun 8, 2023
8ab0912
Update vignettes/deepdive.Rmd
bms63 Jun 8, 2023
f9193b9
docs: #84 removed TODOs. moved library() calls
bms63 Jun 8, 2023
dfb66b1
docs: #84 news tweak
bms63 Jun 8, 2023
b309c84
docs: #150 removing br
bms63 Jun 8, 2023
a51bbbe
chore: #84 missing package
bms63 Jun 8, 2023
9e6003d
docs: #150 display msgs, removed additional br, improved wordflow
bms63 Jun 8, 2023
93b481d
chore: #150 lint
bms63 Jun 8, 2023
ba7e540
chore: #150 style
bms63 Jun 8, 2023
bea320e
docs: #84 merge in devel
bms63 Jun 11, 2023
6fffb8f
fix: #84 order update brought in
bms63 Jun 11, 2023
58dee7b
update: #84 merge in get started updates
bms63 Jun 11, 2023
0203d28
chore: #84 fixing style and lint
bms63 Jun 11, 2023
d2ee389
docs: #84 formatting DT
bms63 Jun 13, 2023
28b001d
Merge branch 'devel' into 84_xportr_deep_dive_vignette
bms63 Jun 13, 2023
58fddba
Update vignettes/deepdive.Rmd
bms63 Jun 13, 2023
c3d829d
Merge branch 'devel' into 84_xportr_deep_dive_vignette
bms63 Jun 14, 2023
fcd5337
chore: #84 spelling updates across package
bms63 Jun 14, 2023
93800fc
Update vignettes/deepdive.Rmd
bms63 Jun 14, 2023
a81cf50
review: #84 comments from PR review
bms63 Jun 14, 2023
b0b7df0
Merge branch '84_xportr_deep_dive_vignette' of https://github.com/ato…
bms63 Jun 14, 2023
f9f441b
Update vignettes/deepdive.Rmd
bms63 Jun 14, 2023
b157beb
docs: #84 css update for DT
bms63 Jun 14, 2023
bd40b2e
Merge branch '84_xportr_deep_dive_vignette' of https://github.com/ato…
bms63 Jun 14, 2023
4d616c2
chore: lint the pkgdown yaml configuration
vedhav Jun 14, 2023
aeac637
docs: #84 scrollable checks, moved png
bms63 Jun 15, 2023
2240608
Merge branch '84_xportr_deep_dive_vignette' of https://github.com/ato…
bms63 Jun 15, 2023
0a0253e
chore: #84 lint and style
bms63 Jun 15, 2023
ead17a8
docs: #84 options verbose section
bms63 Jun 15, 2023
c0c9dcb
bundles all suggestions for datatables in xportr and deepdive
averissimo Jun 15, 2023
f59f106
fix: styler problems
averissimo Jun 15, 2023
4ac1758
fix: typo
averissimo Jun 15, 2023
f8d2800
Merge pull request #160 from atorus-research/84_datatables
bms63 Jun 15, 2023
fb7ad19
docs: #84 readme update, revert type back
bms63 Jun 15, 2023
f632838
Merge branch 'devel' into 84_xportr_deep_dive_vignette
bms63 Jun 15, 2023
fa58e0c
Merge branch 'devel' into 84_xportr_deep_dive_vignette
bms63 Jun 15, 2023
cf60609
review: #84 format update
bms63 Jun 15, 2023
ebea401
Merge branch '84_xportr_deep_dive_vignette' of https://github.com/ato…
bms63 Jun 15, 2023
67b6925
docs: #84 adjusted type discussion
bms63 Jun 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@
^advs\.xpt$
^advs_Define-Excel-Spec_match_admiral\.xlsx
^cran-comments\.md$
^example_data_specs$
^deepdive.Rmd$
2 changes: 2 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,5 @@ Suggests:
metacore
Config/testthat/edition: 3
VignetteBuilder: knitr
Depends:
R (>= 2.10)
bms63 marked this conversation as resolved.
Show resolved Hide resolved
13 changes: 8 additions & 5 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@

## New Features and Bug Fixes

* Fixed an issue where `xportr_type` would overwrite column labels, widths, and "sas.formats"
* Fixed messaging of `xportr_order`to give better visability of the number of variables being reordered.
* Add new argument to `xportr_write` to allow users to specify how xpt validation checks are handled.
* Fixed an issue where `xportr_type()` would overwrite column labels, widths, and "sas.formats"
* Fixed messaging of `xportr_order()`to give better visability of the number of variables being reordered.
* Add new argument to `xportr_write()` to allow users to specify how xpt validation checks are handled.
* Fixed bug where character_types were case sensitive. They are now case insensitive.
* Updated `xportr_type` to make type coercion more explicit.
* Updated `xportr_type()` to make type coercion more explicit.
* Added function `xportr_metadata()` to explicitly set metadata at the start of a pipeline (#44)

## Documentation

* Moved `{pkgdown}` site to bootswatch. Enabled search and linked slack icon (#122).
* Additional vignette showcasing functions and quality of life utilities for processing `xpts` created (#84)

## Deprecation and Breaking Changes

## Deprecation
and Breaking Changes

* The `metacore` argument has been renamed to `metadata` in the following six xportr functions: `xportr_df_label()`, `xportr_format()`, `xportr_label()`, `xportr_length()`, `xportr_order()`, and `xportr_type()`. Please update your code to use the new `metadata` argument in place of `metacore`.
# xportr 0.2.0
Expand Down
84 changes: 84 additions & 0 deletions R/data.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#' Analysis Dataset Subject Level
#'
#' An example dataset containing subject level data
#'
#' @format ## `adsl`
#' A data frame with 254 rows and 48 columns:
#' \describe{
#' \item{STUDYID}{Study Identifier}
#' \item{USUBJID}{Unique Subject Identifier}
#' \item{SUBJID}{Subject Identifier for the Study}
#' \item{SITEID}{Study Site Identifier}
#' \item{SITEGR1}{Pooled Site Group 1}
#' \item{ARM}{Description of Planned Arm}
#' \item{TRT01P}{Planned Treatment for Period 01}
#' \item{TRT01PN}{Planned Treatment for Period 01 (N)}
#' \item{TRT01A}{Actual Treatment for Period 01}
#' \item{TRT01AN}{Actual Treatment for Period 01 (N)}
#' \item{TRTSDT}{Date of First Exposure to Treatment}
#' \item{TRTEDT}{Date of Last Exposure to Treatment}
#' \item{TRTDUR}{Duration of Treatment (days)}
#' \item{AVGDD}{Avg Daily Dose (as planned)}
#' \item{CUMDOSE}{Cumulative Dose (as planned)}
#' \item{AGE}{Age}
#' \item{AGEGR1}{Pooled Age Group 1}
#' \item{AGEGR1N}{Pooled Age Group 1 (N)}
#' \item{AGEU}{Age Units}
#' \item{RACE}{Race}
#' \item{RACEN}{Race (N)}
#' \item{SEX}{Sex}
#' \item{ETHNIC}{Ethnicity}
#' \item{SAFFL}{Safety Population Flag}
#' \item{ITTFL}{Intent-To-Treat Population Flag}
#' \item{EFFFL}{Efficacy Population Flag}
#' \item{COMP8FL}{Completers of Week 8 Population Flag}
#' \item{COMP16FL}{Completers of Week 16 Population Flag}
#' \item{COMP24FL}{Completers of Week 24 Population Flag}
#' \item{DISCONFL}{Did the Subject Discontinue the Study}
#' \item{DSRAEFL}{Discontinued due to AE}
#' \item{DTHFL}{Subject Died}
#' \item{BMIBL}{Baseline BMI (kg/m^2)}
#' \item{BMIBLGR1}{Pooled Baseline BMI Group 1}
#' \item{HEIGHTBL}{Baseline Height (cm)}
#' \item{WEIGHTBL}{Baseline Weight (kg)}
#' \item{EDUCLVL}{Years of Education}
#' \item{DISONSDT}{Date of Onset of Disease}
#' \item{DURDIS}{Duration of Disease (Months)}
#' \item{DURDSGR1}{Pooled Disease Duration Group 1}
#' \item{VISIT1DT}{Date of Visit 1}
#' \item{RFSTDTC}{Subject Reference Start Date/Time}
#' \item{RFENDTC}{Subject Reference End Date/Time}
#' \item{VISNUMEN}{End of Trt Visit (Vis 12 or Early Term.)}
#' \item{RFENDT}{Date of Discontinuation/Completion}
#' \item{DCDECOD}{Standardized Disposition Term}
#' \item{DCREASCD}{Reason for Discontinuation}
#' \item{MMSETOT}{MMSE Total}
#' }
"adsl"

#' Example Dataset Specification
#'
#' @format ## `var_spec`
#' A data frame with 216 rows and 19 columns:
#' \describe{
#' \item{Order}{Order of variable}
#' \item{Dataset}{Dataset}
#' \item{Variable}{Variable}
#' \item{Label}{Variable Label}
#' \item{Data Type}{Data Type}
#' \item{Length}{Variable Length}
#' \item{Significant Digits}{Significant Digits}
#' \item{Format}{Variable Format}
#' \item{Mandatory}{Mandatory Variable Flag}
#' \item{Assigned Value}{Variable Assigned Value}
#' \item{Codelist}{Variable Codelist}
#' \item{Common}{Common Variable Flag}
#' \item{Origin}{Variable Origin}
#' \item{Pages}{Pages}
#' \item{Method}{Variable Method}
#' \item{Predecessor}{Variable Predecessor}
#' \item{Role}{Variable Role}
#' \item{Comment}{Comment}
#' \item{Developer Notes}{Developer Notes}
#' }
"var_spec"
11 changes: 5 additions & 6 deletions R/format.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,11 @@
#' )
#'
#' adsl <- xportr_format(adsl, metadata)
xportr_format <- function(
.df,
metadata = NULL,
domain = NULL,
verbose = getOption("xportr.length_verbose", "none"),
metacore = deprecated()) {
xportr_format <- function(.df,
metadata = NULL,
domain = NULL,
verbose = getOption("xportr.length_verbose", "none"),
metacore = deprecated()) {
if (!missing(metacore)) {
lifecycle::deprecate_warn(
when = "0.3.0",
Expand Down
11 changes: 5 additions & 6 deletions R/label.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,11 @@
#' )
#'
#' adsl <- xportr_label(adsl, metadata)
xportr_label <- function(
.df,
metadata = NULL,
domain = NULL,
verbose = getOption("xportr.length_verbose", "none"),
metacore = deprecated()) {
xportr_label <- function(.df,
metadata = NULL,
domain = NULL,
verbose = getOption("xportr.length_verbose", "none"),
metacore = deprecated()) {
if (!missing(metacore)) {
lifecycle::deprecate_warn(
when = "0.3.0",
Expand Down
11 changes: 5 additions & 6 deletions R/length.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,11 @@
#' )
#'
#' adsl <- xportr_length(adsl, metadata)
xportr_length <- function(
.df,
metadata = NULL,
domain = NULL,
verbose = getOption("xportr.length_verbose", "none"),
metacore = deprecated()) {
xportr_length <- function(.df,
metadata = NULL,
domain = NULL,
verbose = getOption("xportr.length_verbose", "none"),
metacore = deprecated()) {
if (!missing(metacore)) {
lifecycle::deprecate_warn(
when = "0.3.0",
Expand Down
11 changes: 5 additions & 6 deletions R/order.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@
#' )
#'
#' adsl <- xportr_order(adsl, metadata)
xportr_order <- function(
.df,
metadata = NULL,
domain = NULL,
verbose = getOption("xportr.length_verbose", "none"),
metacore = deprecated()) {
xportr_order <- function(.df,
metadata = NULL,
domain = NULL,
verbose = getOption("xportr.length_verbose", "none"),
metacore = deprecated()) {
if (!missing(metacore)) {
lifecycle::deprecate_warn(
when = "0.3.0",
Expand Down
16 changes: 9 additions & 7 deletions R/type.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,11 @@
#' )
#'
#' df2 <- xportr_type(.df, metadata, "test")
xportr_type <- function(
.df,
metadata = NULL,
domain = NULL,
verbose = getOption("xportr.length_verbose", "none"),
metacore = deprecated()) {
xportr_type <- function(.df,
metadata = NULL,
domain = NULL,
verbose = getOption("xportr.length_verbose", "none"),
metacore = deprecated()) {
if (!missing(metacore)) {
lifecycle::deprecate_warn(
when = "0.3.0",
Expand All @@ -63,8 +62,11 @@ xportr_type <- function(

## Pull out correct metadata
metadata <- metadata %||%
attr(.df, "_xportr.df_metadata_") %||%
attr(.df, "_xportr.df_metadata_")
bms63 marked this conversation as resolved.
Show resolved Hide resolved

if (is.null(metadata)) {
rlang::abort("Metadata must be set with `metadata` or `xportr_metadata()`")
}

if (inherits(metadata, "Metacore")) {
metadata <- metadata$var_spec
Expand Down
13 changes: 13 additions & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,19 @@ adsl %>%
xportr_write("adsl.xpt", label = "Subject-Level Analysis Dataset")
```

The `xportr_metadata()` function can reduce duplication by setting the variable specification and domain explicitly at the top of a pipeline.

```{r, message=FALSE, eval=FALSE}
adsl %>%
xportr_metadata(var_spec, "ADSL") %>%
xportr_type() %>%
xportr_length() %>%
xportr_label() %>%
xportr_order() %>%
xportr_format() %>%
xportr_write("adsl.xpt", label = "Subject-Level Analysis Dataset")
```

That's it! We now have a xpt file created in R with all appropriate types, lengths, labels, ordering and formats. Please check out the [Get Started](https://atorus-research.github.io/xportr/articles/xportr.html) for more information and detailed walk through of each `xportr_` function.

We are in talks with other Pharma companies involved with the [`{pharmaverse}`](https://pharmaverse.org/) to enhance this package to play well with other downstream and upstream packages.
Expand Down
14 changes: 9 additions & 5 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ navbar:
href: https://pharmaverse.slack.com/archives/C030EB2M4GM
aria-label: slack


reference:
- title: The six core xportr functions
- contents:
bms63 marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -40,10 +39,10 @@ reference:
- xportr_df_label
- xportr_metadata

- title: xportr
navbar: ~
contents:
- xportr
- title: xportr example datasets and specification files
- contents:
- adsl
- var_spec

- title: internal
contents:
Expand All @@ -53,4 +52,9 @@ reference:
- minimal_table


articles:
- title: ~
navbar: ~
contents:
- deepdive

Binary file added data/adsl.rda
Binary file not shown.
Binary file added data/var_spec.rda
Binary file not shown.
Binary file not shown.
Binary file added example_data_specs/TDF_ADaM_Pilot3.xlsx
Binary file not shown.
Binary file added example_data_specs/adadas.xpt
Binary file not shown.
Binary file added example_data_specs/adae.xpt
Binary file not shown.
Binary file added example_data_specs/adlbc.xpt
Binary file not shown.
Binary file added example_data_specs/adtte.xpt
Binary file not shown.
1 change: 1 addition & 0 deletions example_data_specs/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Data taken from Pilot 3 Submission Study: https://github.com/RConsortium/submissions-pilot3-adam
69 changes: 69 additions & 0 deletions man/adsl.Rd

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

Binary file modified man/figures/design_flow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions man/var_spec.Rd

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

Loading