metadata <- data.frame (
dataset = "test" ,
variable = c ( "Subj" , "Param" , "Val" , "NotUsed" ) ,
- type = c ( "numeric" , "character" , "numeric" , "character" ) ,
- format = NA
+ type = c ( "numeric" , "character" , "numeric" , "character" )
)
.df <- data.frame (
diff --git a/dev/reference/xportr_write.html b/dev/reference/xportr_write.html
index 96c7d9a2..5e1d295e 100644
--- a/dev/reference/xportr_write.html
+++ b/dev/reference/xportr_write.html
@@ -14,7 +14,7 @@
xportr
- 0.3.1.9015
+ 0.3.1.9016
diff --git a/dev/reference/xpt_validate.html b/dev/reference/xpt_validate.html
index 2720eb16..967a9b3e 100644
--- a/dev/reference/xpt_validate.html
+++ b/dev/reference/xpt_validate.html
@@ -12,7 +12,7 @@
xportr
- 0.3.1.9015
+ 0.3.1.9016
diff --git a/dev/search.json b/dev/search.json
index b0aa5b3b..d2a59c70 100644
--- a/dev/search.json
+++ b/dev/search.json
@@ -1 +1 @@
-[{"path":"https://atorus-research.github.io/xportr/dev/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2021 Atorus/GSK JPT Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/articles/deepdive.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Deep Dive into xportr","text":"vignette explore detail possibilities xportr package applying information metadata object R created dataset using core xportr functions. also explore following: goes Submission Health Authority, role xportr play Submission? xportr validating behind scenes? Breakdown xportr ADaM dataset specification file. Using options() xportr_metadata() enhance xportr experience. Understanding warning error messages xportr function. brief discussion future work. NOTE: use phrase metadata object throughout package. metadata object can either specification file read R dataframe metacore object. metadata object created via metacore package additional features covered , core using specification file. However, xportr work either dataframe metacore object.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/articles/deepdive.html","id":"what-goes-in-a-submission-to-a-health-authority","dir":"Articles","previous_headings":"","what":"What goes in a Submission to a Health Authority?","title":"Deep Dive into xportr","text":"Quite bit! focus data deliverables supporting documentation needed successful submission Health Authority xportr can play key role. briefly look three parts: Study Data Standardization Plan SDTM Data Package ADaM Data Package","code":""},{"path":"https://atorus-research.github.io/xportr/dev/articles/deepdive.html","id":"study-data-standardization-plan","dir":"Articles","previous_headings":"What goes in a Submission to a Health Authority?","what":"Study Data Standardization Plan","title":"Deep Dive into xportr","text":"Study Data Standardization Plan (SDSP) establishes documents plan describing data standardization approach clinical nonclinical studies within development program. SDSP also assists FDA identifying potential data standardization issues early development program. hope brevity section belie huge importance document. Please see Study Data Standardisation Plan (SDSP) Package maintained PHUSE working group. However, want focus actual data xportr can play role submission.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/articles/deepdive.html","id":"sdtm-and-adam-data-packages","dir":"Articles","previous_headings":"What goes in a Submission to a Health Authority?","what":"SDTM and ADaM Data Packages","title":"Deep Dive into xportr","text":"SDTM: primary pieces SDTM package SDTM annotated case report forms (acrf.pdf), data definitions document (define.xml), Study Data Reviewer’s Guide (sdrg.pdf) datasets xpt Version 5 format. Version 5 xpt file required submission format datasets going Health Authorities. ADaM: key components ADaM package similar SDTM package additions: define.xml, Analysis Study Data Reviewer’s Guide (adrg.pdf), Analysis Results Metadata (analysis-results-metadata.pdf) datasets Version 5 xpt format. Data Packages need compliant xpt files, feel xportr can play pivotal role . core functions xportr can used apply information metadata object datasets giving users feedback quality metadata data. xportr_write() can used write final dataset xpt file, can submitted Health Authority.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/articles/deepdive.html","id":"what-is-xportr-validating-in-these-data-packages","dir":"Articles","previous_headings":"What goes in a Submission to a Health Authority?","what":"What is {xportr} validating in these Data Packages?","title":"Deep Dive into xportr","text":"xpt Version 5 files form backbone successful Submission govern quite lot rules suggested guidelines. preparing data packages submission suite core xportr functions, plus xportr_write(), helps check datasets submission compliant. package checks many latest rules laid Study Data Technical Conformance Guide, please note yet exhaustive list checks. envision users also submitting xpts metadata additional validation software. core xportr functions applying labels, types, formats, order lengths provides feedback users submission compliance. However, final check implemented xportr_write() called create xpt. xportr_write() calls xpt_validate(), behind scenes/non-exported function final check compliance. time {xportr} v0.3.0 checking following user writes xpt file.:","code":""},{"path":"https://atorus-research.github.io/xportr/dev/articles/deepdive.html","id":"xportr-in-action","dir":"Articles","previous_headings":"","what":"{xportr} in action","title":"Deep Dive into xportr","text":"section, going explore 5 core xportr functions using: xportr::adsl - ADSL ADaM dataset Pilot 3 Submission FDA xportr::var_spec - ADSL ADaM Specification File Pilot 3 Submission FDA focus warning error messaging contrived examples functions manipulating either datasets specification files. NOTE: made ADSL Spec available package. Users can find additional datasets specification files repo example_data_specs folder. keep package minimum size.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/articles/deepdive.html","id":"using-options-and-xportr_metadata-to-enhance-your-experience-","dir":"Articles","previous_headings":"{xportr} in action","what":"Using options() and xportr_metadata() to enhance your experience.","title":"Deep Dive into xportr","text":"dive functions, want point quality life utilities make xpt generation life little bit easier. options() xportr_options() xportr_metadata() NOTE: long well-defined metadata object need use options() xportr_metadata(), find handy use think deserve quick mention!","code":""},{"path":"https://atorus-research.github.io/xportr/dev/articles/deepdive.html","id":"youve-got-options-or-xportr_options","dir":"Articles","previous_headings":"{xportr} in action","what":"You’ve got options() or xportr_options()","title":"Deep Dive into xportr","text":"xportr built certain assumptions around specification column names information columns. found company specification file can differ slightly assumptions. example, one company might call column Variables, another Variable another variables. Rather trying regex situation, introduced options(). options() allows users control assumptions inside xportr functions based needs. Additionally, helper function xportr_options() works just like options() , can also used get current state xportr options. Let’s take look example specification file names available package. can see columns start upper case letter spaces several . convert column names lower case deal spacing using dplyr functions base R, just use options()! using options() xportr_options() beginning script can tell xportr valid names (see chunk ). Please note set options package assumed every thing lowercase spaces names. running options() xportr_options(), xportr sees column Variable valid name rather variable. can inspect xportr_options function docs look additional options.","code":"library(rlang) library(xportr) library(dplyr) library(haven) colnames(var_spec) [1] \"Order\" \"Dataset\" \"Variable\" [4] \"Label\" \"Data Type\" \"Length\" [7] \"Significant Digits\" \"Format\" \"Mandatory\" [10] \"Assigned Value\" \"Codelist\" \"Common\" [13] \"Origin\" \"Pages\" \"Method\" [16] \"Predecessor\" \"Role\" \"Comment\" [19] \"Developer Notes\" xportr_options( xportr.variable_name = \"Variable\", xportr.label = \"Label\", xportr.type_name = \"Data Type\", xportr.format = \"Format\", xportr.length = \"Length\", xportr.order_name = \"Order\" ) # Or alternatively options( xportr.variable_name = \"Variable\", xportr.label = \"Label\", xportr.type_name = \"Data Type\", xportr.format = \"Format\", xportr.length = \"Length\", xportr.order_name = \"Order\" )"},{"path":"https://atorus-research.github.io/xportr/dev/articles/deepdive.html","id":"are-we-being-too-verbose","dir":"Articles","previous_headings":"{xportr} in action","what":"Are we being too verbose?","title":"Deep Dive into xportr","text":"One final note options. 4 core xportr functions ability set messaging \"none\", \"message\", \"warn\", \"stop\". Setting calls can bit repetitive. can use options() xportr_options() set higher level avoid repetition.","code":"# Default verbose is set to `none` xportr_options( xportr.format_verbose = \"none\", xportr.label_verbose = \"none\", xportr.length_verbose = \"none\", xportr.type_verbose = \"none\" ) xportr_options( xportr.format_verbose = \"none\", # Disables any messaging, keeping the console output clean xportr.label_verbose = \"message\", # Sends a standard message to the console xportr.length_verbose = \"warn\", # Sends a warning message to the console xportr.type_verbose = \"stop\" # Stops execution and sends an error message to the console )"},{"path":"https://atorus-research.github.io/xportr/dev/articles/deepdive.html","id":"going-meta","dir":"Articles","previous_headings":"{xportr} in action","what":"Going meta","title":"Deep Dive into xportr","text":"core xportr functions requires several inputs: valid dataframe, metadata object domain name, along optional messaging. example, simple call using functions. can see, lot information repeated call. help reduce repetitive calls, created xportr_metadata(). user can just set metadata object Domain name first call, passed functions. Much cleaner!","code":"adsl %>% xportr_type(var_spec, \"ADSL\", \"message\") %>% xportr_length(var_spec, \"ADSL\", verbose = \"message\") %>% xportr_label(var_spec, \"ADSL\", \"message\") %>% xportr_order(var_spec, \"ADSL\", \"message\") %>% xportr_format(var_spec, \"ADSL\") %>% xportr_df_label(dataset_spec, \"ADSL\") %>% xportr_write(\"adsl.xpt\") adsl %>% xportr_metadata(var_spec, \"ADSL\") %>% xportr_type() %>% xportr_length(length_source = \"metadata\") %>% xportr_label() %>% xportr_order() %>% xportr_format() %>% xportr_df_label(dataset_spec) %>% xportr_write(\"adsl.xpt\")"},{"path":"https://atorus-research.github.io/xportr/dev/articles/deepdive.html","id":"warnings-and-errors","dir":"Articles","previous_headings":"{xportr} in action","what":"Warnings and Errors","title":"Deep Dive into xportr","text":"next six sections, going explore Warnings Errors messages generated xportr core functions. better explore , either manipulate ADaM dataset specification file help showcase ability xportr functions detect issues. NOTE: made ADSL, xportr::adsl, Specification File, xportr::var_spec, available package. Users can find additional datasets specification files repo example_data_specs folder.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/articles/deepdive.html","id":"setting-up-our-metadata-object","dir":"Articles","previous_headings":"{xportr} in action > Warnings and Errors","what":"Setting up our metadata object","title":"Deep Dive into xportr","text":"First, let’s read specification file call var_spec. Note using options() . slight manipulation column names lower case, changing Data Type type making Order column numeric. can also use options() step well. var_spec object five dataset specification files stacked top . make use ADSL subset var_spec. can make use Search field dataset column subset specification file ADSL Similarly, can read Dataset spec file call dataset_spec.","code":"var_spec <- var_spec %>% rename(type = \"Data Type\") %>% set_names(tolower) dataset_spec <- dataset_spec %>% rename(label = \"Description\") %>% set_names(tolower)"},{"path":"https://atorus-research.github.io/xportr/dev/articles/deepdive.html","id":"xportr_type","dir":"Articles","previous_headings":"{xportr} in action","what":"xportr_type()","title":"Deep Dive into xportr","text":"going explore type column metadata object. submission Health Authority character numeric types data. ADSL data several columns Date type: TRTSDT, TRTEDT, DISONSDT, VISIT1DT RFENDT - hood actually numeric values left . change one variable type factor variable, common data structure R, give us educational opportunities see xportr_type() action. Success! can see , xportr_type() applied types metadata object STUDYID variables converting proper type. functions xportr also display coercion user console, seen . Note xportr_type(verbose = \"warn\") set function provided feedback, show console, variables converted warning message. However, can set verbose = \"stop\" types applied data match specification file. Using verbose = \"stop\" instantly stop processing function create object. user need alter variables R script using xportr_type()","code":"adsl_fct <- adsl %>% mutate(STUDYID = as_factor(STUDYID)) Rows: 254 Columns: 6 $ STUDYID CDISCPILOT01, CDISCPILOT01, CDISCPILOT01, CDISCPILOT01, CDISC… $ TRTSDT 2014-01-02, 2012-08-05, 2013-07-19, 2014-03-18, 2014-07-01, … $ TRTEDT 2014-07-02, 2012-09-01, 2014-01-14, 2014-03-31, 2014-12-30, … $ DISONSDT 2010-04-30, 2006-03-11, 2009-12-16, 2009-08-02, 2011-09-29, … $ VISIT1DT 2013-12-26, 2012-07-22, 2013-07-11, 2014-03-10, 2014-06-24, … $ RFENDT 2014-07-02, 2012-09-02, 2014-01-14, 2014-04-14, 2014-12-30, … adsl_type <- xportr_type(.df = adsl_fct, metadata = var_spec, domain = \"ADSL\", verbose = \"warn\") ── Variable type mismatches found. ── ✔ 1 variables coerced Warning: Variable type(s) in dataframe don't match metadata: `STUDYID` glimpse(adsl_type_glimpse) Rows: 254 Columns: 6 $ STUDYID \"CDISCPILOT01\", \"CDISCPILOT01\", \"CDISCPILOT01\", \"CDISCPILOT01… $ TRTSDT 2014-01-02, 2012-08-05, 2013-07-19, 2014-03-18, 2014-07-01, … $ TRTEDT 2014-07-02, 2012-09-01, 2014-01-14, 2014-03-31, 2014-12-30, … $ DISONSDT 2010-04-30, 2006-03-11, 2009-12-16, 2009-08-02, 2011-09-29, … $ VISIT1DT 2013-12-26, 2012-07-22, 2013-07-11, 2014-03-10, 2014-06-24, … $ RFENDT 2014-07-02, 2012-09-02, 2014-01-14, 2014-04-14, 2014-12-30, … adsl_type <- xportr_type(.df = adsl_fct, metadata = var_spec, domain = \"ADSL\", verbose = \"stop\") ── Variable type mismatches found. ── ✔ 1 variables coerced Error in `xportr_logger()`: ! Variable type(s) in dataframe don't match metadata: `STUDYID`"},{"path":"https://atorus-research.github.io/xportr/dev/articles/deepdive.html","id":"xportr_length","dir":"Articles","previous_headings":"{xportr} in action","what":"xportr_length()","title":"Deep Dive into xportr","text":"Next use xportr_length() apply length column metadata object ADSL dataset. Using str() function displayed variables attributes. can see variable label, information lengths variable. Using xportr_length() verbose = \"warn\" can apply length column columns dataset. function detects two variables, TRTDUR DCREASCD missing metadata file. Note variables slight misspellings dataset metadata, great catch! However, lengths still applied TRTDUR give length 8 DCREASCD length 200. Using str() function, can see xportr_length() successfully applied lengths variable variables dataset. Just like xportr_type(), setting verbose = \"stop\" immediately stops R processing lengths. function detects missing variables apply lengths dataset corrective action applied.","code":"tibble [254 × 48] (S3: tbl_df/tbl/data.frame) $ STUDYID : chr [1:254] \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" ... ..- attr(*, \"label\")= chr \"Study Identifier\" $ USUBJID : chr [1:254] \"01-701-1015\" \"01-701-1023\" \"01-701-1028\" \"01-701-1033\" ... ..- attr(*, \"label\")= chr \"Unique Subject Identifier\" $ SUBJID : chr [1:254] \"1015\" \"1023\" \"1028\" \"1033\" ... ..- attr(*, \"label\")= chr \"Subject Identifier for the Study\" $ SITEID : chr [1:254] \"701\" \"701\" \"701\" \"701\" ... ..- attr(*, \"label\")= chr \"Study Site Identifier\" $ SITEGR1 : chr [1:254] \"701\" \"701\" \"701\" \"701\" ... ..- attr(*, \"label\")= chr \"Pooled Site Group 1\" $ ARM : chr [1:254] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Planned Arm\" $ TRT01P : chr [1:254] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Planned Treatment for Period 01\" $ TRT01PN : num [1:254] 0 0 81 54 81 0 54 54 54 0 ... ..- attr(*, \"label\")= chr \"Planned Treatment for Period 01 (N)\" $ TRT01A : chr [1:254] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Actual Treatment for Period 01\" $ TRT01AN : num [1:254] 0 0 81 54 81 0 54 54 54 0 ... ..- attr(*, \"label\")= chr \"Actual Treatment for Period 01 (N)\" $ TRTSDT : Date[1:254], format: \"2014-01-02\" \"2012-08-05\" ... $ TRTEDT : Date[1:254], format: \"2014-07-02\" \"2012-09-01\" ... $ TRTDUR : num [1:254] 182 28 180 14 183 26 190 10 55 182 ... ..- attr(*, \"label\")= chr \"Duration of Treatment (days)\" $ AVGDD : num [1:254] 0 0 77.7 54 76.9 0 54 54 54 0 ... ..- attr(*, \"label\")= chr \"Avg Daily Dose (as planned)\" $ CUMDOSE : num [1:254] 0 0 13986 756 14067 ... ..- attr(*, \"label\")= chr \"Cumulative Dose (as planned)\" $ AGE : num [1:254] 63 64 71 74 77 85 68 81 84 52 ... ..- attr(*, \"label\")= chr \"Age\" $ AGEGR1 : chr [1:254] \"<65\" \"<65\" \"65-80\" \"65-80\" ... ..- attr(*, \"label\")= chr \"Pooled Age Group 1\" $ AGEGR1N : num [1:254] 1 1 2 2 2 3 2 3 3 1 ... ..- attr(*, \"label\")= chr \"Pooled Age Group 1 (N)\" $ AGEU : chr [1:254] \"YEARS\" \"YEARS\" \"YEARS\" \"YEARS\" ... ..- attr(*, \"label\")= chr \"Age Units\" $ RACE : chr [1:254] \"WHITE\" \"WHITE\" \"WHITE\" \"WHITE\" ... ..- attr(*, \"label\")= chr \"Race\" $ RACEN : num [1:254] 1 1 1 1 1 1 1 1 1 1 ... ..- attr(*, \"label\")= chr \"Race (N)\" $ SEX : chr [1:254] \"F\" \"M\" \"M\" \"M\" ... ..- attr(*, \"label\")= chr \"Sex\" $ ETHNIC : chr [1:254] \"HISPANIC OR LATINO\" \"HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" ... ..- attr(*, \"label\")= chr \"Ethnicity\" $ SAFFL : chr [1:254] \"Y\" \"Y\" \"Y\" \"Y\" ... ..- attr(*, \"label\")= chr \"Safety Population Flag\" $ ITTFL : chr [1:254] \"Y\" \"Y\" \"Y\" \"Y\" ... ..- attr(*, \"label\")= chr \"Intent-To-Treat Population Flag\" $ EFFFL : chr [1:254] \"Y\" \"Y\" \"Y\" \"Y\" ... ..- attr(*, \"label\")= chr \"Efficacy Population Flag\" $ COMP8FL : chr [1:254] \"Y\" \"N\" \"Y\" \"N\" ... ..- attr(*, \"label\")= chr \"Completers of Week 8 Population Flag\" $ COMP16FL: chr [1:254] \"Y\" \"N\" \"Y\" \"N\" ... ..- attr(*, \"label\")= chr \"Completers of Week 16 Population Flag\" $ COMP24FL: chr [1:254] \"Y\" \"N\" \"Y\" \"N\" ... ..- attr(*, \"label\")= chr \"Completers of Week 24 Population Flag\" $ DISCONFL: chr [1:254] \"\" \"Y\" \"\" \"Y\" ... ..- attr(*, \"label\")= chr \"Did the Subject Discontinue the Study?\" $ DSRAEFL : chr [1:254] \"\" \"Y\" \"\" \"\" ... ..- attr(*, \"label\")= chr \"Discontinued due to AE?\" $ DTHFL : chr [1:254] \"\" \"\" \"\" \"\" ... ..- attr(*, \"label\")= chr \"Subject Died?\" $ BMIBL : num [1:254] 25.1 30.4 31.4 28.8 26.1 30.4 27.3 23.9 23.9 21.9 ... ..- attr(*, \"label\")= chr \"Baseline BMI (kg/m^2)\" $ BMIBLGR1: chr [1:254] \"25-<30\" \">=30\" \">=30\" \"25-<30\" ... ..- attr(*, \"label\")= chr \"Pooled Baseline BMI Group 1\" $ HEIGHTBL: num [1:254] 147 163 178 175 155 ... ..- attr(*, \"label\")= chr \"Baseline Height (cm)\" $ WEIGHTBL: num [1:254] 54.4 80.3 99.3 88.5 62.6 67.1 78 59.9 78.9 71.2 ... ..- attr(*, \"label\")= chr \"Baseline Weight (kg)\" $ EDUCLVL : num [1:254] 16 14 16 12 9 8 18 22 12 14 ... ..- attr(*, \"label\")= chr \"Years of Education\" $ DISONSDT: Date[1:254], format: \"2010-04-30\" \"2006-03-11\" ... $ DURDIS : num [1:254] 43.9 76.4 42.8 55.3 32.9 ... ..- attr(*, \"label\")= chr \"Duration of Disease (Months)\" $ DURDSGR1: chr [1:254] \">=12\" \">=12\" \">=12\" \">=12\" ... ..- attr(*, \"label\")= chr \"Pooled Disease Duration Group 1\" $ VISIT1DT: Date[1:254], format: \"2013-12-26\" \"2012-07-22\" ... $ RFSTDTC : chr [1:254] \"2014-01-02\" \"2012-08-05\" \"2013-07-19\" \"2014-03-18\" ... ..- attr(*, \"label\")= chr \"Subject Reference Start Date/Time\" $ RFENDTC : chr [1:254] \"2014-07-02\" \"2012-09-02\" \"2014-01-14\" \"2014-04-14\" ... ..- attr(*, \"label\")= chr \"Subject Reference End Date/Time\" $ VISNUMEN: num [1:254] 12 5 12 5 12 6 12 4 8 12 ... ..- attr(*, \"label\")= chr \"End of Trt Visit (Vis 12 or Early Term.)\" $ RFENDT : Date[1:254], format: \"2014-07-02\" \"2012-09-02\" ... $ DCDECOD : chr [1:254] \"COMPLETED\" \"ADVERSE EVENT\" \"COMPLETED\" \"STUDY TERMINATED BY SPONSOR\" ... ..- attr(*, \"label\")= chr \"Standardized Disposition Term\" $ DCREASCD: chr [1:254] \"Completed\" \"Adverse Event\" \"Completed\" \"Sponsor Decision\" ... ..- attr(*, \"label\")= chr \"Reason for Discontinuation\" $ MMSETOT : num [1:254] 23 23 23 23 21 23 10 23 20 20 ... ..- attr(*, \"label\")= chr \"MMSE Total\" adsl_length <- xportr_length( .df = adsl, metadata = var_spec, domain = \"ADSL\", verbose = \"warn\", length_source = \"metadata\" ) ── Variable lengths missing from metadata. ── ✔ 2 lengths resolved Warning: Variable(s) present in dataframe but doesn't exist in `metadata`.Problem with `TRTDUR` and `DCREASCD` tibble [254 × 48] (S3: tbl_df/tbl/data.frame) $ STUDYID : chr [1:254] \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" ... ..- attr(*, \"label\")= chr \"Study Identifier\" ..- attr(*, \"width\")= chr \"12\" $ USUBJID : chr [1:254] \"01-701-1015\" \"01-701-1023\" \"01-701-1028\" \"01-701-1033\" ... ..- attr(*, \"label\")= chr \"Unique Subject Identifier\" ..- attr(*, \"width\")= chr \"11\" $ SUBJID : chr [1:254] \"1015\" \"1023\" \"1028\" \"1033\" ... ..- attr(*, \"label\")= chr \"Subject Identifier for the Study\" ..- attr(*, \"width\")= chr \"4\" $ SITEID : chr [1:254] \"701\" \"701\" \"701\" \"701\" ... ..- attr(*, \"label\")= chr \"Study Site Identifier\" ..- attr(*, \"width\")= chr \"3\" $ SITEGR1 : chr [1:254] \"701\" \"701\" \"701\" \"701\" ... ..- attr(*, \"label\")= chr \"Pooled Site Group 1\" ..- attr(*, \"width\")= chr \"3\" $ ARM : chr [1:254] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Planned Arm\" ..- attr(*, \"width\")= chr \"20\" $ TRT01P : chr [1:254] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Planned Treatment for Period 01\" ..- attr(*, \"width\")= chr \"20\" $ TRT01PN : num [1:254] 0 0 81 54 81 0 54 54 54 0 ... ..- attr(*, \"label\")= chr \"Planned Treatment for Period 01 (N)\" ..- attr(*, \"width\")= chr \"8\" $ TRT01A : chr [1:254] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Actual Treatment for Period 01\" ..- attr(*, \"width\")= chr \"20\" $ TRT01AN : num [1:254] 0 0 81 54 81 0 54 54 54 0 ... ..- attr(*, \"label\")= chr \"Actual Treatment for Period 01 (N)\" ..- attr(*, \"width\")= chr \"8\" $ TRTSDT : Date[1:254], format: \"2014-01-02\" \"2012-08-05\" ... $ TRTEDT : Date[1:254], format: \"2014-07-02\" \"2012-09-01\" ... $ TRTDUR : num [1:254] 182 28 180 14 183 26 190 10 55 182 ... ..- attr(*, \"label\")= chr \"Duration of Treatment (days)\" ..- attr(*, \"width\")= num 8 $ AVGDD : num [1:254] 0 0 77.7 54 76.9 0 54 54 54 0 ... ..- attr(*, \"label\")= chr \"Avg Daily Dose (as planned)\" ..- attr(*, \"width\")= chr \"8\" $ CUMDOSE : num [1:254] 0 0 13986 756 14067 ... ..- attr(*, \"label\")= chr \"Cumulative Dose (as planned)\" ..- attr(*, \"width\")= chr \"8\" $ AGE : num [1:254] 63 64 71 74 77 85 68 81 84 52 ... ..- attr(*, \"label\")= chr \"Age\" ..- attr(*, \"width\")= chr \"8\" $ AGEGR1 : chr [1:254] \"<65\" \"<65\" \"65-80\" \"65-80\" ... ..- attr(*, \"label\")= chr \"Pooled Age Group 1\" ..- attr(*, \"width\")= chr \"5\" $ AGEGR1N : num [1:254] 1 1 2 2 2 3 2 3 3 1 ... ..- attr(*, \"label\")= chr \"Pooled Age Group 1 (N)\" ..- attr(*, \"width\")= chr \"8\" $ AGEU : chr [1:254] \"YEARS\" \"YEARS\" \"YEARS\" \"YEARS\" ... ..- attr(*, \"label\")= chr \"Age Units\" ..- attr(*, \"width\")= chr \"5\" $ RACE : chr [1:254] \"WHITE\" \"WHITE\" \"WHITE\" \"WHITE\" ... ..- attr(*, \"label\")= chr \"Race\" ..- attr(*, \"width\")= chr \"32\" $ RACEN : num [1:254] 1 1 1 1 1 1 1 1 1 1 ... ..- attr(*, \"label\")= chr \"Race (N)\" ..- attr(*, \"width\")= chr \"8\" $ SEX : chr [1:254] \"F\" \"M\" \"M\" \"M\" ... ..- attr(*, \"label\")= chr \"Sex\" ..- attr(*, \"width\")= chr \"1\" $ ETHNIC : chr [1:254] \"HISPANIC OR LATINO\" \"HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" ... ..- attr(*, \"label\")= chr \"Ethnicity\" ..- attr(*, \"width\")= chr \"22\" $ SAFFL : chr [1:254] \"Y\" \"Y\" \"Y\" \"Y\" ... ..- attr(*, \"label\")= chr \"Safety Population Flag\" ..- attr(*, \"width\")= chr \"1\" $ ITTFL : chr [1:254] \"Y\" \"Y\" \"Y\" \"Y\" ... ..- attr(*, \"label\")= chr \"Intent-To-Treat Population Flag\" ..- attr(*, \"width\")= chr \"1\" $ EFFFL : chr [1:254] \"Y\" \"Y\" \"Y\" \"Y\" ... ..- attr(*, \"label\")= chr \"Efficacy Population Flag\" ..- attr(*, \"width\")= chr \"1\" $ COMP8FL : chr [1:254] \"Y\" \"N\" \"Y\" \"N\" ... ..- attr(*, \"label\")= chr \"Completers of Week 8 Population Flag\" ..- attr(*, \"width\")= chr \"1\" $ COMP16FL: chr [1:254] \"Y\" \"N\" \"Y\" \"N\" ... ..- attr(*, \"label\")= chr \"Completers of Week 16 Population Flag\" ..- attr(*, \"width\")= chr \"1\" $ COMP24FL: chr [1:254] \"Y\" \"N\" \"Y\" \"N\" ... ..- attr(*, \"label\")= chr \"Completers of Week 24 Population Flag\" ..- attr(*, \"width\")= chr \"1\" $ DISCONFL: chr [1:254] \"\" \"Y\" \"\" \"Y\" ... ..- attr(*, \"label\")= chr \"Did the Subject Discontinue the Study?\" ..- attr(*, \"width\")= chr \"1\" $ DSRAEFL : chr [1:254] \"\" \"Y\" \"\" \"\" ... ..- attr(*, \"label\")= chr \"Discontinued due to AE?\" ..- attr(*, \"width\")= chr \"1\" $ DTHFL : chr [1:254] \"\" \"\" \"\" \"\" ... ..- attr(*, \"label\")= chr \"Subject Died?\" ..- attr(*, \"width\")= chr \"1\" $ BMIBL : num [1:254] 25.1 30.4 31.4 28.8 26.1 30.4 27.3 23.9 23.9 21.9 ... ..- attr(*, \"label\")= chr \"Baseline BMI (kg/m^2)\" ..- attr(*, \"width\")= chr \"8\" $ BMIBLGR1: chr [1:254] \"25-<30\" \">=30\" \">=30\" \"25-<30\" ... ..- attr(*, \"label\")= chr \"Pooled Baseline BMI Group 1\" ..- attr(*, \"width\")= chr \"6\" $ HEIGHTBL: num [1:254] 147 163 178 175 155 ... ..- attr(*, \"label\")= chr \"Baseline Height (cm)\" ..- attr(*, \"width\")= chr \"8\" $ WEIGHTBL: num [1:254] 54.4 80.3 99.3 88.5 62.6 67.1 78 59.9 78.9 71.2 ... ..- attr(*, \"label\")= chr \"Baseline Weight (kg)\" ..- attr(*, \"width\")= chr \"8\" $ EDUCLVL : num [1:254] 16 14 16 12 9 8 18 22 12 14 ... ..- attr(*, \"label\")= chr \"Years of Education\" ..- attr(*, \"width\")= chr \"8\" $ DISONSDT: Date[1:254], format: \"2010-04-30\" \"2006-03-11\" ... $ DURDIS : num [1:254] 43.9 76.4 42.8 55.3 32.9 ... ..- attr(*, \"label\")= chr \"Duration of Disease (Months)\" ..- attr(*, \"width\")= chr \"8\" $ DURDSGR1: chr [1:254] \">=12\" \">=12\" \">=12\" \">=12\" ... ..- attr(*, \"label\")= chr \"Pooled Disease Duration Group 1\" ..- attr(*, \"width\")= chr \"4\" $ VISIT1DT: Date[1:254], format: \"2013-12-26\" \"2012-07-22\" ... $ RFSTDTC : chr [1:254] \"2014-01-02\" \"2012-08-05\" \"2013-07-19\" \"2014-03-18\" ... ..- attr(*, \"label\")= chr \"Subject Reference Start Date/Time\" ..- attr(*, \"width\")= chr \"20\" $ RFENDTC : chr [1:254] \"2014-07-02\" \"2012-09-02\" \"2014-01-14\" \"2014-04-14\" ... ..- attr(*, \"label\")= chr \"Subject Reference End Date/Time\" ..- attr(*, \"width\")= chr \"20\" $ VISNUMEN: num [1:254] 12 5 12 5 12 6 12 4 8 12 ... ..- attr(*, \"label\")= chr \"End of Trt Visit (Vis 12 or Early Term.)\" ..- attr(*, \"width\")= chr \"8\" $ RFENDT : Date[1:254], format: \"2014-07-02\" \"2012-09-02\" ... $ DCDECOD : chr [1:254] \"COMPLETED\" \"ADVERSE EVENT\" \"COMPLETED\" \"STUDY TERMINATED BY SPONSOR\" ... ..- attr(*, \"label\")= chr \"Standardized Disposition Term\" ..- attr(*, \"width\")= chr \"27\" $ DCREASCD: chr [1:254] \"Completed\" \"Adverse Event\" \"Completed\" \"Sponsor Decision\" ... ..- attr(*, \"label\")= chr \"Reason for Discontinuation\" ..- attr(*, \"width\")= num 200 $ MMSETOT : num [1:254] 23 23 23 23 21 23 10 23 20 20 ... ..- attr(*, \"label\")= chr \"MMSE Total\" ..- attr(*, \"width\")= chr \"8\" - attr(*, \"_xportr.df_arg_\")= chr \"ADSL\" adsl_length <- xportr_length( .df = adsl, metadata = var_spec, domain = \"ADSL\", verbose = \"stop\", length_source = \"metadata\" ) ── Variable lengths missing from metadata. ── ✔ 2 lengths resolved Error in `xportr_logger()`: ! Variable(s) present in dataframe but doesn't exist in `metadata`.Problem with `TRTDUR` and `DCREASCD`"},{"path":"https://atorus-research.github.io/xportr/dev/articles/deepdive.html","id":"xportr_label","dir":"Articles","previous_headings":"{xportr} in action","what":"xportr_label()","title":"Deep Dive into xportr","text":"creating dataset R often find R removes label variable. Using xportr_label() can easily re-apply labels variables one quick action. example, going manipulate metadata ADSL dataset: metadata variable TRTSDT label greater 40 characters. ADSL dataset labels stripped . Remember length example, labels original dataset seen str() output. successfully removed labels. Using xportr_label() apply labels metadata dataset. Please note using verbose = \"warn\" two issues TRTDUR DCREASCD reported missing metadata file. additional message sent around TRTSDT label length greater 40. Success! labels applied present metadata dataset. However, please note TRTSDT variable label characters greater 40 applied dataset TRTDUR DCREASCD empty variable labels. Just like functions, setting verbose = \"stop\" immediately stops R processing labels. function detects mismatches variables labels well label greater 40 characters. stops process, none labels applied dataset corrective action applied.","code":"var_spec_lbl <- var_spec %>% mutate(label = if_else(variable == \"TRTSDT\", \"Length of variable label must be 40 characters or less\", label )) adsl_lbl <- adsl adsl_lbl <- haven::zap_label(adsl) tibble [254 × 48] (S3: tbl_df/tbl/data.frame) $ STUDYID : chr [1:254] \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" ... $ USUBJID : chr [1:254] \"01-701-1015\" \"01-701-1023\" \"01-701-1028\" \"01-701-1033\" ... $ SUBJID : chr [1:254] \"1015\" \"1023\" \"1028\" \"1033\" ... $ SITEID : chr [1:254] \"701\" \"701\" \"701\" \"701\" ... $ SITEGR1 : chr [1:254] \"701\" \"701\" \"701\" \"701\" ... $ ARM : chr [1:254] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... $ TRT01P : chr [1:254] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... $ TRT01PN : num [1:254] 0 0 81 54 81 0 54 54 54 0 ... $ TRT01A : chr [1:254] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... $ TRT01AN : num [1:254] 0 0 81 54 81 0 54 54 54 0 ... $ TRTSDT : Date[1:254], format: \"2014-01-02\" \"2012-08-05\" ... $ TRTEDT : Date[1:254], format: \"2014-07-02\" \"2012-09-01\" ... $ TRTDUR : num [1:254] 182 28 180 14 183 26 190 10 55 182 ... $ AVGDD : num [1:254] 0 0 77.7 54 76.9 0 54 54 54 0 ... $ CUMDOSE : num [1:254] 0 0 13986 756 14067 ... $ AGE : num [1:254] 63 64 71 74 77 85 68 81 84 52 ... $ AGEGR1 : chr [1:254] \"<65\" \"<65\" \"65-80\" \"65-80\" ... $ AGEGR1N : num [1:254] 1 1 2 2 2 3 2 3 3 1 ... $ AGEU : chr [1:254] \"YEARS\" \"YEARS\" \"YEARS\" \"YEARS\" ... $ RACE : chr [1:254] \"WHITE\" \"WHITE\" \"WHITE\" \"WHITE\" ... $ RACEN : num [1:254] 1 1 1 1 1 1 1 1 1 1 ... $ SEX : chr [1:254] \"F\" \"M\" \"M\" \"M\" ... $ ETHNIC : chr [1:254] \"HISPANIC OR LATINO\" \"HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" ... $ SAFFL : chr [1:254] \"Y\" \"Y\" \"Y\" \"Y\" ... $ ITTFL : chr [1:254] \"Y\" \"Y\" \"Y\" \"Y\" ... $ EFFFL : chr [1:254] \"Y\" \"Y\" \"Y\" \"Y\" ... $ COMP8FL : chr [1:254] \"Y\" \"N\" \"Y\" \"N\" ... $ COMP16FL: chr [1:254] \"Y\" \"N\" \"Y\" \"N\" ... $ COMP24FL: chr [1:254] \"Y\" \"N\" \"Y\" \"N\" ... $ DISCONFL: chr [1:254] \"\" \"Y\" \"\" \"Y\" ... $ DSRAEFL : chr [1:254] \"\" \"Y\" \"\" \"\" ... $ DTHFL : chr [1:254] \"\" \"\" \"\" \"\" ... $ BMIBL : num [1:254] 25.1 30.4 31.4 28.8 26.1 30.4 27.3 23.9 23.9 21.9 ... $ BMIBLGR1: chr [1:254] \"25-<30\" \">=30\" \">=30\" \"25-<30\" ... $ HEIGHTBL: num [1:254] 147 163 178 175 155 ... $ WEIGHTBL: num [1:254] 54.4 80.3 99.3 88.5 62.6 67.1 78 59.9 78.9 71.2 ... $ EDUCLVL : num [1:254] 16 14 16 12 9 8 18 22 12 14 ... $ DISONSDT: Date[1:254], format: \"2010-04-30\" \"2006-03-11\" ... $ DURDIS : num [1:254] 43.9 76.4 42.8 55.3 32.9 ... $ DURDSGR1: chr [1:254] \">=12\" \">=12\" \">=12\" \">=12\" ... $ VISIT1DT: Date[1:254], format: \"2013-12-26\" \"2012-07-22\" ... $ RFSTDTC : chr [1:254] \"2014-01-02\" \"2012-08-05\" \"2013-07-19\" \"2014-03-18\" ... $ RFENDTC : chr [1:254] \"2014-07-02\" \"2012-09-02\" \"2014-01-14\" \"2014-04-14\" ... $ VISNUMEN: num [1:254] 12 5 12 5 12 6 12 4 8 12 ... $ RFENDT : Date[1:254], format: \"2014-07-02\" \"2012-09-02\" ... $ DCDECOD : chr [1:254] \"COMPLETED\" \"ADVERSE EVENT\" \"COMPLETED\" \"STUDY TERMINATED BY SPONSOR\" ... $ DCREASCD: chr [1:254] \"Completed\" \"Adverse Event\" \"Completed\" \"Sponsor Decision\" ... $ MMSETOT : num [1:254] 23 23 23 23 21 23 10 23 20 20 ... adsl_lbl <- xportr_label(.df = adsl_lbl, metadata = var_spec_lbl, domain = \"ADSL\", verbose = \"warn\") ── Variable labels missing from metadata. ── ✔ 2 labels skipped Warning: Variable(s) present in dataframe but doesn't exist in `metadata`. ✖ Problem with `TRTDUR` and `DCREASCD` Warning: Length of variable label must be 40 characters or less. ✖ Problem with `TRTSDT`. tibble [254 × 48] (S3: tbl_df/tbl/data.frame) $ STUDYID : chr [1:254] \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" ... ..- attr(*, \"label\")= chr \"Study Identifier\" $ USUBJID : chr [1:254] \"01-701-1015\" \"01-701-1023\" \"01-701-1028\" \"01-701-1033\" ... ..- attr(*, \"label\")= chr \"Unique Subject Identifier\" $ SUBJID : chr [1:254] \"1015\" \"1023\" \"1028\" \"1033\" ... ..- attr(*, \"label\")= chr \"Subject Identifier for the Study\" $ SITEID : chr [1:254] \"701\" \"701\" \"701\" \"701\" ... ..- attr(*, \"label\")= chr \"Study Site Identifier\" $ SITEGR1 : chr [1:254] \"701\" \"701\" \"701\" \"701\" ... ..- attr(*, \"label\")= chr \"Pooled Site Group 1\" $ ARM : chr [1:254] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Planned Arm\" $ TRT01P : chr [1:254] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Planned Treatment for Period 01\" $ TRT01PN : num [1:254] 0 0 81 54 81 0 54 54 54 0 ... ..- attr(*, \"label\")= chr \"Planned Treatment for Period 01 (N)\" $ TRT01A : chr [1:254] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Actual Treatment for Period 01\" $ TRT01AN : num [1:254] 0 0 81 54 81 0 54 54 54 0 ... ..- attr(*, \"label\")= chr \"Actual Treatment for Period 01 (N)\" $ TRTSDT : Date[1:254], format: \"2014-01-02\" \"2012-08-05\" ... $ TRTEDT : Date[1:254], format: \"2014-07-02\" \"2012-09-01\" ... $ TRTDUR : num [1:254] 182 28 180 14 183 26 190 10 55 182 ... ..- attr(*, \"label\")= chr \"\" $ AVGDD : num [1:254] 0 0 77.7 54 76.9 0 54 54 54 0 ... ..- attr(*, \"label\")= chr \"Avg Daily Dose (as planned)\" $ CUMDOSE : num [1:254] 0 0 13986 756 14067 ... ..- attr(*, \"label\")= chr \"Cumulative Dose (as planned)\" $ AGE : num [1:254] 63 64 71 74 77 85 68 81 84 52 ... ..- attr(*, \"label\")= chr \"Age\" $ AGEGR1 : chr [1:254] \"<65\" \"<65\" \"65-80\" \"65-80\" ... ..- attr(*, \"label\")= chr \"Pooled Age Group 1\" $ AGEGR1N : num [1:254] 1 1 2 2 2 3 2 3 3 1 ... ..- attr(*, \"label\")= chr \"Pooled Age Group 1 (N)\" $ AGEU : chr [1:254] \"YEARS\" \"YEARS\" \"YEARS\" \"YEARS\" ... ..- attr(*, \"label\")= chr \"Age Units\" $ RACE : chr [1:254] \"WHITE\" \"WHITE\" \"WHITE\" \"WHITE\" ... ..- attr(*, \"label\")= chr \"Race\" $ RACEN : num [1:254] 1 1 1 1 1 1 1 1 1 1 ... ..- attr(*, \"label\")= chr \"Race (N)\" $ SEX : chr [1:254] \"F\" \"M\" \"M\" \"M\" ... ..- attr(*, \"label\")= chr \"Sex\" $ ETHNIC : chr [1:254] \"HISPANIC OR LATINO\" \"HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" ... ..- attr(*, \"label\")= chr \"Ethnicity\" $ SAFFL : chr [1:254] \"Y\" \"Y\" \"Y\" \"Y\" ... ..- attr(*, \"label\")= chr \"Safety Population Flag\" $ ITTFL : chr [1:254] \"Y\" \"Y\" \"Y\" \"Y\" ... ..- attr(*, \"label\")= chr \"Intent-To-Treat Population Flag\" $ EFFFL : chr [1:254] \"Y\" \"Y\" \"Y\" \"Y\" ... ..- attr(*, \"label\")= chr \"Efficacy Population Flag\" $ COMP8FL : chr [1:254] \"Y\" \"N\" \"Y\" \"N\" ... ..- attr(*, \"label\")= chr \"Completers of Week 8 Population Flag\" $ COMP16FL: chr [1:254] \"Y\" \"N\" \"Y\" \"N\" ... ..- attr(*, \"label\")= chr \"Completers of Week 16 Population Flag\" $ COMP24FL: chr [1:254] \"Y\" \"N\" \"Y\" \"N\" ... ..- attr(*, \"label\")= chr \"Completers of Week 24 Population Flag\" $ DISCONFL: chr [1:254] \"\" \"Y\" \"\" \"Y\" ... ..- attr(*, \"label\")= chr \"Did the Subject Discontinue the Study?\" $ DSRAEFL : chr [1:254] \"\" \"Y\" \"\" \"\" ... ..- attr(*, \"label\")= chr \"Discontinued due to AE?\" $ DTHFL : chr [1:254] \"\" \"\" \"\" \"\" ... ..- attr(*, \"label\")= chr \"Subject Died?\" $ BMIBL : num [1:254] 25.1 30.4 31.4 28.8 26.1 30.4 27.3 23.9 23.9 21.9 ... ..- attr(*, \"label\")= chr \"Baseline BMI (kg/m^2)\" $ BMIBLGR1: chr [1:254] \"25-<30\" \">=30\" \">=30\" \"25-<30\" ... ..- attr(*, \"label\")= chr \"Pooled Baseline BMI Group 1\" $ HEIGHTBL: num [1:254] 147 163 178 175 155 ... ..- attr(*, \"label\")= chr \"Baseline Height (cm)\" $ WEIGHTBL: num [1:254] 54.4 80.3 99.3 88.5 62.6 67.1 78 59.9 78.9 71.2 ... ..- attr(*, \"label\")= chr \"Baseline Weight (kg)\" $ EDUCLVL : num [1:254] 16 14 16 12 9 8 18 22 12 14 ... ..- attr(*, \"label\")= chr \"Years of Education\" $ DISONSDT: Date[1:254], format: \"2010-04-30\" \"2006-03-11\" ... $ DURDIS : num [1:254] 43.9 76.4 42.8 55.3 32.9 ... ..- attr(*, \"label\")= chr \"Duration of Disease (Months)\" $ DURDSGR1: chr [1:254] \">=12\" \">=12\" \">=12\" \">=12\" ... ..- attr(*, \"label\")= chr \"Pooled Disease Duration Group 1\" $ VISIT1DT: Date[1:254], format: \"2013-12-26\" \"2012-07-22\" ... $ RFSTDTC : chr [1:254] \"2014-01-02\" \"2012-08-05\" \"2013-07-19\" \"2014-03-18\" ... ..- attr(*, \"label\")= chr \"Subject Reference Start Date/Time\" $ RFENDTC : chr [1:254] \"2014-07-02\" \"2012-09-02\" \"2014-01-14\" \"2014-04-14\" ... ..- attr(*, \"label\")= chr \"Subject Reference End Date/Time\" $ VISNUMEN: num [1:254] 12 5 12 5 12 6 12 4 8 12 ... ..- attr(*, \"label\")= chr \"End of Trt Visit (Vis 12 or Early Term.)\" $ RFENDT : Date[1:254], format: \"2014-07-02\" \"2012-09-02\" ... $ DCDECOD : chr [1:254] \"COMPLETED\" \"ADVERSE EVENT\" \"COMPLETED\" \"STUDY TERMINATED BY SPONSOR\" ... ..- attr(*, \"label\")= chr \"Standardized Disposition Term\" $ DCREASCD: chr [1:254] \"Completed\" \"Adverse Event\" \"Completed\" \"Sponsor Decision\" ... ..- attr(*, \"label\")= chr \"\" $ MMSETOT : num [1:254] 23 23 23 23 21 23 10 23 20 20 ... ..- attr(*, \"label\")= chr \"MMSE Total\" - attr(*, \"_xportr.df_arg_\")= chr \"ADSL\" adsl_label <- xportr_label(.df = adsl_lbl, metadata = var_spec_lbl, domain = \"ADSL\", verbose = \"stop\") ── Variable labels missing from metadata. ── ✔ 2 labels skipped Error in `xportr_logger()`: ! Variable(s) present in dataframe but doesn't exist in `metadata`. ✖ Problem with `TRTDUR` and `DCREASCD`"},{"path":"https://atorus-research.github.io/xportr/dev/articles/deepdive.html","id":"xportr_order","dir":"Articles","previous_headings":"{xportr} in action","what":"xportr_order()","title":"Deep Dive into xportr","text":"order dataset can greatly increase readability dataset downstream stakeholders. example, treatment related variables analysis variables grouped together can help inspection understanding dataset. xportr_order() can take order information metadata apply dataset. Readers encouraged inspect dataset metadata see past order updated order calling function. Note messaging xportr_order(): Variables metadata moved end Variables order re-ordered message printed ones re-ordered. Just like functions, setting verbose = \"stop\" immediately stops R processing order. variables metadata missing either, re-ordering process corrective action performed.","code":"adsl_ord <- xportr_order(.df = adsl, metadata = var_spec, domain = \"ADSL\", verbose = \"warn\") ── 2 variables not in spec and moved to end ── Warning: Variable moved to end in `.df`: `TRTDUR` and `DCREASCD` ── 36 reordered in dataset ── Warning: Variable reordered in `.df`: `AVGDD`, `CUMDOSE`, `AGE`, `AGEGR1`, `AGEGR1N`, `AGEU`, `RACE`, `RACEN`, `SEX`, `ETHNIC`, `SAFFL`, `ITTFL`, `EFFFL`, `COMP8FL`, `COMP16FL`, `COMP24FL`, `DISCONFL`, `DSRAEFL`, `DTHFL`, `BMIBL`, `BMIBLGR1`, `HEIGHTBL`, `WEIGHTBL`, `EDUCLVL`, `DISONSDT`, `DURDIS`, `DURDSGR1`, `VISIT1DT`, `RFSTDTC`, `RFENDTC`, `VISNUMEN`, `RFENDT`, `DCDECOD`, `MMSETOT`, `TRTDUR`, and `DCREASCD` adsl_ord <- xportr_order(.df = adsl, metadata = var_spec, domain = \"ADSL\", verbose = \"stop\") ── 2 variables not in spec and moved to end ── Error in `xportr_logger()`: ! Variable moved to end in `.df`: `TRTDUR` and `DCREASCD`"},{"path":"https://atorus-research.github.io/xportr/dev/articles/deepdive.html","id":"xportr_format","dir":"Articles","previous_headings":"{xportr} in action","what":"xportr_format()","title":"Deep Dive into xportr","text":"Formats play important role SAS language column specification files. able easily apply formats xpt file allow downstream users SAS quickly format data appropriately reading SAS-based system. xportr_format() can take formats apply . Please reference xportr_length() xportr_label() note missing attr() formats ADSL dataset. example slightly different previous examples. need use xportr_type() coerce R Date variables others types character numeric. can use xportr_format() apply format column dataset. Success! taken metadata formats applied dataset. Please inspect variables like TRTSDT DISONSDT see DATE9. format applied. time {xportr} v0.3.0 implemented warnings error messaging function. However, xportr_write() xpt_validate() check formats applied valid SAS formats.","code":"adsl_fmt <- adsl %>% xportr_type(metadata = var_spec, domain = \"ADSL\", verbose = \"warn\") %>% xportr_format(metadata = var_spec, domain = \"ADSL\") tibble [254 × 48] (S3: tbl_df/tbl/data.frame) $ STUDYID : chr [1:254] \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" ... ..- attr(*, \"label\")= chr \"Study Identifier\" ..- attr(*, \"format.sas\")= chr \"\" $ USUBJID : chr [1:254] \"01-701-1015\" \"01-701-1023\" \"01-701-1028\" \"01-701-1033\" ... ..- attr(*, \"label\")= chr \"Unique Subject Identifier\" ..- attr(*, \"format.sas\")= chr \"\" $ SUBJID : chr [1:254] \"1015\" \"1023\" \"1028\" \"1033\" ... ..- attr(*, \"label\")= chr \"Subject Identifier for the Study\" ..- attr(*, \"format.sas\")= chr \"\" $ SITEID : chr [1:254] \"701\" \"701\" \"701\" \"701\" ... ..- attr(*, \"label\")= chr \"Study Site Identifier\" ..- attr(*, \"format.sas\")= chr \"\" $ SITEGR1 : chr [1:254] \"701\" \"701\" \"701\" \"701\" ... ..- attr(*, \"label\")= chr \"Pooled Site Group 1\" ..- attr(*, \"format.sas\")= chr \"\" $ ARM : chr [1:254] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Planned Arm\" ..- attr(*, \"format.sas\")= chr \"\" $ TRT01P : chr [1:254] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Planned Treatment for Period 01\" ..- attr(*, \"format.sas\")= chr \"\" $ TRT01PN : num [1:254] 0 0 81 54 81 0 54 54 54 0 ... ..- attr(*, \"label\")= chr \"Planned Treatment for Period 01 (N)\" ..- attr(*, \"format.sas\")= chr \"\" $ TRT01A : chr [1:254] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Actual Treatment for Period 01\" ..- attr(*, \"format.sas\")= chr \"\" $ TRT01AN : num [1:254] 0 0 81 54 81 0 54 54 54 0 ... ..- attr(*, \"label\")= chr \"Actual Treatment for Period 01 (N)\" ..- attr(*, \"format.sas\")= chr \"\" $ TRTSDT : Date[1:254], format: \"2014-01-02\" \"2012-08-05\" ... $ TRTEDT : Date[1:254], format: \"2014-07-02\" \"2012-09-01\" ... $ TRTDUR : num [1:254] 182 28 180 14 183 26 190 10 55 182 ... ..- attr(*, \"label\")= chr \"Duration of Treatment (days)\" ..- attr(*, \"format.sas\")= chr \"\" $ AVGDD : num [1:254] 0 0 77.7 54 76.9 0 54 54 54 0 ... ..- attr(*, \"label\")= chr \"Avg Daily Dose (as planned)\" ..- attr(*, \"format.sas\")= chr \"\" $ CUMDOSE : num [1:254] 0 0 13986 756 14067 ... ..- attr(*, \"label\")= chr \"Cumulative Dose (as planned)\" ..- attr(*, \"format.sas\")= chr \"\" $ AGE : num [1:254] 63 64 71 74 77 85 68 81 84 52 ... ..- attr(*, \"label\")= chr \"Age\" ..- attr(*, \"format.sas\")= chr \"\" $ AGEGR1 : chr [1:254] \"<65\" \"<65\" \"65-80\" \"65-80\" ... ..- attr(*, \"label\")= chr \"Pooled Age Group 1\" ..- attr(*, \"format.sas\")= chr \"\" $ AGEGR1N : num [1:254] 1 1 2 2 2 3 2 3 3 1 ... ..- attr(*, \"label\")= chr \"Pooled Age Group 1 (N)\" ..- attr(*, \"format.sas\")= chr \"\" $ AGEU : chr [1:254] \"YEARS\" \"YEARS\" \"YEARS\" \"YEARS\" ... ..- attr(*, \"label\")= chr \"Age Units\" ..- attr(*, \"format.sas\")= chr \"\" $ RACE : chr [1:254] \"WHITE\" \"WHITE\" \"WHITE\" \"WHITE\" ... ..- attr(*, \"label\")= chr \"Race\" ..- attr(*, \"format.sas\")= chr \"\" $ RACEN : num [1:254] 1 1 1 1 1 1 1 1 1 1 ... ..- attr(*, \"label\")= chr \"Race (N)\" ..- attr(*, \"format.sas\")= chr \"\" $ SEX : chr [1:254] \"F\" \"M\" \"M\" \"M\" ... ..- attr(*, \"label\")= chr \"Sex\" ..- attr(*, \"format.sas\")= chr \"\" $ ETHNIC : chr [1:254] \"HISPANIC OR LATINO\" \"HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" ... ..- attr(*, \"label\")= chr \"Ethnicity\" ..- attr(*, \"format.sas\")= chr \"\" $ SAFFL : chr [1:254] \"Y\" \"Y\" \"Y\" \"Y\" ... ..- attr(*, \"label\")= chr \"Safety Population Flag\" ..- attr(*, \"format.sas\")= chr \"\" $ ITTFL : chr [1:254] \"Y\" \"Y\" \"Y\" \"Y\" ... ..- attr(*, \"label\")= chr \"Intent-To-Treat Population Flag\" ..- attr(*, \"format.sas\")= chr \"\" $ EFFFL : chr [1:254] \"Y\" \"Y\" \"Y\" \"Y\" ... ..- attr(*, \"label\")= chr \"Efficacy Population Flag\" ..- attr(*, \"format.sas\")= chr \"\" $ COMP8FL : chr [1:254] \"Y\" \"N\" \"Y\" \"N\" ... ..- attr(*, \"label\")= chr \"Completers of Week 8 Population Flag\" ..- attr(*, \"format.sas\")= chr \"\" $ COMP16FL: chr [1:254] \"Y\" \"N\" \"Y\" \"N\" ... ..- attr(*, \"label\")= chr \"Completers of Week 16 Population Flag\" ..- attr(*, \"format.sas\")= chr \"\" $ COMP24FL: chr [1:254] \"Y\" \"N\" \"Y\" \"N\" ... ..- attr(*, \"label\")= chr \"Completers of Week 24 Population Flag\" ..- attr(*, \"format.sas\")= chr \"\" $ DISCONFL: chr [1:254] \"\" \"Y\" \"\" \"Y\" ... ..- attr(*, \"label\")= chr \"Did the Subject Discontinue the Study?\" ..- attr(*, \"format.sas\")= chr \"\" $ DSRAEFL : chr [1:254] \"\" \"Y\" \"\" \"\" ... ..- attr(*, \"label\")= chr \"Discontinued due to AE?\" ..- attr(*, \"format.sas\")= chr \"\" $ DTHFL : chr [1:254] \"\" \"\" \"\" \"\" ... ..- attr(*, \"label\")= chr \"Subject Died?\" ..- attr(*, \"format.sas\")= chr \"\" $ BMIBL : num [1:254] 25.1 30.4 31.4 28.8 26.1 30.4 27.3 23.9 23.9 21.9 ... ..- attr(*, \"label\")= chr \"Baseline BMI (kg/m^2)\" ..- attr(*, \"format.sas\")= chr \"\" $ BMIBLGR1: chr [1:254] \"25-<30\" \">=30\" \">=30\" \"25-<30\" ... ..- attr(*, \"label\")= chr \"Pooled Baseline BMI Group 1\" ..- attr(*, \"format.sas\")= chr \"\" $ HEIGHTBL: num [1:254] 147 163 178 175 155 ... ..- attr(*, \"label\")= chr \"Baseline Height (cm)\" ..- attr(*, \"format.sas\")= chr \"\" $ WEIGHTBL: num [1:254] 54.4 80.3 99.3 88.5 62.6 67.1 78 59.9 78.9 71.2 ... ..- attr(*, \"label\")= chr \"Baseline Weight (kg)\" ..- attr(*, \"format.sas\")= chr \"\" $ EDUCLVL : num [1:254] 16 14 16 12 9 8 18 22 12 14 ... ..- attr(*, \"label\")= chr \"Years of Education\" ..- attr(*, \"format.sas\")= chr \"\" $ DISONSDT: Date[1:254], format: \"2010-04-30\" \"2006-03-11\" ... $ DURDIS : num [1:254] 43.9 76.4 42.8 55.3 32.9 ... ..- attr(*, \"label\")= chr \"Duration of Disease (Months)\" ..- attr(*, \"format.sas\")= chr \"\" $ DURDSGR1: chr [1:254] \">=12\" \">=12\" \">=12\" \">=12\" ... ..- attr(*, \"label\")= chr \"Pooled Disease Duration Group 1\" ..- attr(*, \"format.sas\")= chr \"\" $ VISIT1DT: Date[1:254], format: \"2013-12-26\" \"2012-07-22\" ... $ RFSTDTC : chr [1:254] \"2014-01-02\" \"2012-08-05\" \"2013-07-19\" \"2014-03-18\" ... ..- attr(*, \"label\")= chr \"Subject Reference Start Date/Time\" ..- attr(*, \"format.sas\")= chr \"\" $ RFENDTC : chr [1:254] \"2014-07-02\" \"2012-09-02\" \"2014-01-14\" \"2014-04-14\" ... ..- attr(*, \"label\")= chr \"Subject Reference End Date/Time\" ..- attr(*, \"format.sas\")= chr \"\" $ VISNUMEN: num [1:254] 12 5 12 5 12 6 12 4 8 12 ... ..- attr(*, \"label\")= chr \"End of Trt Visit (Vis 12 or Early Term.)\" ..- attr(*, \"format.sas\")= chr \"\" $ RFENDT : Date[1:254], format: \"2014-07-02\" \"2012-09-02\" ... $ DCDECOD : chr [1:254] \"COMPLETED\" \"ADVERSE EVENT\" \"COMPLETED\" \"STUDY TERMINATED BY SPONSOR\" ... ..- attr(*, \"label\")= chr \"Standardized Disposition Term\" ..- attr(*, \"format.sas\")= chr \"\" $ DCREASCD: chr [1:254] \"Completed\" \"Adverse Event\" \"Completed\" \"Sponsor Decision\" ... ..- attr(*, \"label\")= chr \"Reason for Discontinuation\" ..- attr(*, \"format.sas\")= chr \"\" $ MMSETOT : num [1:254] 23 23 23 23 21 23 10 23 20 20 ... ..- attr(*, \"label\")= chr \"MMSE Total\" ..- attr(*, \"format.sas\")= chr \"\" - attr(*, \"_xportr.df_arg_\")= chr \"ADSL\""},{"path":"https://atorus-research.github.io/xportr/dev/articles/deepdive.html","id":"xportr_write","dir":"Articles","previous_headings":"{xportr} in action","what":"xportr_write()","title":"Deep Dive into xportr","text":"Finally, want write xpt dataset metadata applied. make use xportr_metadata() reduce repetitive metadata domain specifications. use default option verbose, just message set anything verbose. xportr_write() specify path, just current working directory, set dataset label toggle strict_checks FALSE. also note worthy can set dataset label using xportr_df_label dataset_spec used xportr_write() Success! applied types, lengths, labels, ordering formats dataset. Note messages written console. Remember TRTDUR DCREASCD present metadata, dataset. impacts messaging lengths labels xportr printing feedback us two issues. 5 types coerced, well 36 variables re-ordered. Note strict_checks set FALSE. next two examples showcase strict_checks = TRUE option xportr_write() look formats labels. several ---DT type variables, xportr_write() detects lack formats applied. correct remember can use xportr_type() xportr_format() apply formats xpt dataset. manipulated labels greater 40 characters TRTSDT. turned xportr_label() verbose options produce message. However, xportr_write() strict_checks = TRUE error one many xpt_validate() checks going behind scenes.","code":"adsl %>% xportr_metadata(var_spec, \"ADSL\") %>% xportr_type() %>% xportr_length(length_source = \"metadata\") %>% xportr_label() %>% xportr_order() %>% xportr_format() %>% xportr_df_label(dataset_spec) %>% xportr_write(path = \"adsl.xpt\", strict_checks = FALSE) ── Variable lengths missing from metadata. ── ✔ 2 lengths resolved ── Variable labels missing from metadata. ── ✔ 2 labels skipped ── 2 variables not in spec and moved to end ── ── 36 reordered in dataset ── adsl %>% xportr_write(path = \"adsl.xpt\", metadata = dataset_spec, domain = \"ADSL\", strict_checks = TRUE) Error in `xportr_write()`: ! The following validation checks failed: • Formats 'TRTSDT', 'TRTEDT', 'DISONSDT', 'VISIT1DT', and 'RFENDT' must have a valid format. var_spec_lbl <- var_spec %>% mutate(label = if_else(variable == \"TRTSDT\", \"Length of variable label must be 40 characters or less\", label )) adsl %>% xportr_metadata(var_spec_lbl, \"ADSL\") %>% xportr_label() %>% xportr_type() %>% xportr_format() %>% xportr_df_label(dataset_spec) %>% xportr_write(path = \"adsl.xpt\", strict_checks = TRUE) ── Variable labels missing from metadata. ── ✔ 2 labels skipped Warning: Length of variable label must be 40 characters or less. ✖ Problem with `TRTSDT`. Error in `xportr_write()`: ! The following validation checks failed: • Label 'TRTSDT=Length of variable label must be 40 characters or less' must be 40 characters or less."},{"path":"https://atorus-research.github.io/xportr/dev/articles/deepdive.html","id":"future-work","dir":"Articles","previous_headings":"{xportr} in action","what":"Future Work","title":"Deep Dive into xportr","text":"xportr still undergoing development. hope produce vignettes functions allow users bulk process multiple datasets well examples piping xpt files related documentation validation software service. always, please let us know feature requests, documentation updates bugs GitHub repo.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/articles/xportr.html","id":"getting-started-with-xportr","dir":"Articles","previous_headings":"","what":"Getting Started with xportr","title":"Getting Started","text":"demo make use small ADSL data set apart {admiral} package. script generates ADSL dataset can created using command admiral::use_ad_template(\"adsl\"). deeper discussion xportr sure check Deep Dive User Guide. ADSL following features: 306 observations 48 variables Data types character numeric Missing labels variables Missing label data set Order variables following specification file Formats missing create fully compliant v5 xpt ADSL dataset, developed using R, need apply 6 main functions within xportr package: xportr_type() xportr_length() xportr_order() xportr_format() xportr_label() xportr_write() NOTE: ADSL dataset can created using command admiral::use_ad_template(\"adsl\").","code":"# Loading packages library(dplyr) library(labelled) library(xportr) library(admiral) library(rlang) library(readxl) # Loading in our example data adsl <- admiral::admiral_adsl"},{"path":"https://atorus-research.github.io/xportr/dev/articles/xportr.html","id":"preparing-your-specification-files","dir":"Articles","previous_headings":"","what":"Preparing your Specification Files","title":"Getting Started","text":"order make use functions within xportr need create R data frame contains specification file. likely need pre-processing spec sheets loading spec files work appropriately xportr functions. Please see example spec sheets system.file(paste0(\"specs/\", \"ADaM_admiral_spec.xlsx\"), package = \"xportr\") see xportr expects specification sheets. quick snapshot specification file pertaining ADSL data set, make use 6 xportr function calls . Take note order, label, type, length format columns.","code":"var_spec <- read_xlsx( system.file(paste0(\"specs/\", \"ADaM_admiral_spec.xlsx\"), package = \"xportr\"), sheet = \"Variables\" ) %>% rename(type = \"Data Type\") %>% set_names(tolower)"},{"path":"https://atorus-research.github.io/xportr/dev/articles/xportr.html","id":"xportr_type","dir":"Articles","previous_headings":"","what":"xportr_type()","title":"Getting Started","text":"NOTE: make use str() expose attributes (length, labels, formats, type) datasets. suppressed calls sake brevity. order compliant transport v5 specifications xpt file can two data types: character numeric/dbl. Currently ADSL data set chr, dbl, time, factor date. Using xportr_type() supplied specification file, can coerce variables ADSL set either numeric character. Now appropriate types applied dataset seen .","code":"tibble [306 × 50] (S3: tbl_df/tbl/data.frame) $ STUDYID : chr [1:306] \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" ... ..- attr(*, \"label\")= chr \"Study Identifier\" $ USUBJID : chr [1:306] \"01-701-1015\" \"01-701-1023\" \"01-701-1028\" \"01-701-1033\" ... ..- attr(*, \"label\")= chr \"Unique Subject Identifier\" $ SUBJID : chr [1:306] \"1015\" \"1023\" \"1028\" \"1033\" ... ..- attr(*, \"label\")= chr \"Subject Identifier for the Study\" $ RFSTDTC : chr [1:306] \"2014-01-02\" \"2012-08-05\" \"2013-07-19\" \"2014-03-18\" ... ..- attr(*, \"label\")= chr \"Subject Reference Start Date/Time\" $ RFENDTC : chr [1:306] \"2014-07-02\" \"2012-09-02\" \"2014-01-14\" \"2014-04-14\" ... ..- attr(*, \"label\")= chr \"Subject Reference End Date/Time\" $ RFXSTDTC: chr [1:306] \"2014-01-02\" \"2012-08-05\" \"2013-07-19\" \"2014-03-18\" ... ..- attr(*, \"label\")= chr \"Date/Time of First Study Treatment\" $ RFXENDTC: chr [1:306] \"2014-07-02\" \"2012-09-01\" \"2014-01-14\" \"2014-03-31\" ... ..- attr(*, \"label\")= chr \"Date/Time of Last Study Treatment\" $ RFICDTC : chr [1:306] NA NA NA NA ... ..- attr(*, \"label\")= chr \"Date/Time of Informed Consent\" $ RFPENDTC: chr [1:306] \"2014-07-02T11:45\" \"2013-02-18\" \"2014-01-14T11:10\" \"2014-09-15\" ... ..- attr(*, \"label\")= chr \"Date/Time of End of Participation\" $ DTHDTC : chr [1:306] NA NA NA NA ... ..- attr(*, \"label\")= chr \"Date/Time of Death\" $ DTHFL : chr [1:306] NA NA NA NA ... ..- attr(*, \"label\")= chr \"Subject Death Flag\" $ SITEID : chr [1:306] \"701\" \"701\" \"701\" \"701\" ... ..- attr(*, \"label\")= chr \"Study Site Identifier\" $ AGE : num [1:306] 63 64 71 74 77 85 59 68 81 84 ... ..- attr(*, \"label\")= chr \"Age\" $ AGEU : chr [1:306] \"YEARS\" \"YEARS\" \"YEARS\" \"YEARS\" ... ..- attr(*, \"label\")= chr \"Age Units\" $ SEX : chr [1:306] \"F\" \"M\" \"M\" \"M\" ... ..- attr(*, \"label\")= chr \"Sex\" $ RACE : chr [1:306] \"WHITE\" \"WHITE\" \"WHITE\" \"WHITE\" ... ..- attr(*, \"label\")= chr \"Race\" $ ETHNIC : chr [1:306] \"HISPANIC OR LATINO\" \"HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" ... ..- attr(*, \"label\")= chr \"Ethnicity\" $ ARMCD : chr [1:306] \"Pbo\" \"Pbo\" \"Xan_Hi\" \"Xan_Lo\" ... ..- attr(*, \"label\")= chr \"Planned Arm Code\" $ ARM : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Planned Arm\" $ ACTARMCD: chr [1:306] \"Pbo\" \"Pbo\" \"Xan_Hi\" \"Xan_Lo\" ... ..- attr(*, \"label\")= chr \"Actual Arm Code\" $ ACTARM : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Actual Arm\" $ COUNTRY : chr [1:306] \"USA\" \"USA\" \"USA\" \"USA\" ... ..- attr(*, \"label\")= chr \"Country\" $ DMDTC : chr [1:306] \"2013-12-26\" \"2012-07-22\" \"2013-07-11\" \"2014-03-10\" ... ..- attr(*, \"label\")= chr \"Date/Time of Collection\" $ DMDY : num [1:306] -7 -14 -8 -8 -7 -21 NA -9 -13 -7 ... ..- attr(*, \"label\")= chr \"Study Day of Collection\" $ TRT01P : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Planned Arm\" $ TRT01A : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Actual Arm\" $ TRTSDTM : POSIXct[1:306], format: \"2014-01-02\" ... $ TRTSTMF : chr [1:306] \"H\" \"H\" \"H\" \"H\" ... $ TRTEDTM : POSIXct[1:306], format: \"2014-07-02 23:59:59\" ... $ TRTETMF : chr [1:306] \"H\" \"H\" \"H\" \"H\" ... $ TRTSDT : Date[1:306], format: \"2014-01-02\" ... $ TRTEDT : Date[1:306], format: \"2014-07-02\" ... $ TRTDURD : num [1:306] 182 28 180 14 183 26 NA 190 10 55 ... $ SCRFDT : Date[1:306], format: NA ... $ EOSDT : Date[1:306], format: \"2014-07-02\" ... $ EOSSTT : chr [1:306] \"COMPLETED\" \"DISCONTINUED\" \"COMPLETED\" \"DISCONTINUED\" ... $ FRVDT : Date[1:306], format: NA ... $ RANDDT : Date[1:306], format: \"2014-01-02\" ... $ DTHDT : Date[1:306], format: NA ... $ DTHADY : num [1:306] NA NA NA NA NA NA NA NA NA NA ... $ LDDTHELD: num [1:306] NA NA NA NA NA NA NA NA NA NA ... $ LSTALVDT: Date[1:306], format: \"2014-07-02\" ... $ AGEGR1 : Factor w/ 3 levels \"<18\",\"18-64\",..: 2 2 3 3 3 3 2 3 3 3 ... $ SAFFL : chr [1:306] \"Y\" \"Y\" \"Y\" \"Y\" ... $ RACEGR1 : chr [1:306] \"White\" \"White\" \"White\" \"White\" ... $ REGION1 : chr [1:306] \"NA\" \"NA\" \"NA\" \"NA\" ... $ LDDTHGR1: chr [1:306] NA NA NA NA ... $ DTH30FL : chr [1:306] NA NA NA NA ... $ DTHA30FL: chr [1:306] NA NA NA NA ... $ DTHB30FL: chr [1:306] NA NA NA NA ... adsl_type <- xportr_type(adsl, var_spec, domain = \"ADSL\", verbose = \"message\") ── Variable type mismatches found. ── ✔ 2 variables coerced Variable type(s) in dataframe don't match metadata: `LSTALVDT` and `AGEGR1` tibble [306 × 50] (S3: tbl_df/tbl/data.frame) $ STUDYID : chr [1:306] \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" ... ..- attr(*, \"label\")= chr \"Study Identifier\" $ USUBJID : chr [1:306] \"01-701-1015\" \"01-701-1023\" \"01-701-1028\" \"01-701-1033\" ... ..- attr(*, \"label\")= chr \"Unique Subject Identifier\" $ SUBJID : chr [1:306] \"1015\" \"1023\" \"1028\" \"1033\" ... ..- attr(*, \"label\")= chr \"Subject Identifier for the Study\" $ RFSTDTC : chr [1:306] \"2014-01-02\" \"2012-08-05\" \"2013-07-19\" \"2014-03-18\" ... ..- attr(*, \"label\")= chr \"Subject Reference Start Date/Time\" $ RFENDTC : chr [1:306] \"2014-07-02\" \"2012-09-02\" \"2014-01-14\" \"2014-04-14\" ... ..- attr(*, \"label\")= chr \"Subject Reference End Date/Time\" $ RFXSTDTC: chr [1:306] \"2014-01-02\" \"2012-08-05\" \"2013-07-19\" \"2014-03-18\" ... ..- attr(*, \"label\")= chr \"Date/Time of First Study Treatment\" $ RFXENDTC: chr [1:306] \"2014-07-02\" \"2012-09-01\" \"2014-01-14\" \"2014-03-31\" ... ..- attr(*, \"label\")= chr \"Date/Time of Last Study Treatment\" $ RFICDTC : chr [1:306] NA NA NA NA ... ..- attr(*, \"label\")= chr \"Date/Time of Informed Consent\" $ RFPENDTC: chr [1:306] \"2014-07-02T11:45\" \"2013-02-18\" \"2014-01-14T11:10\" \"2014-09-15\" ... ..- attr(*, \"label\")= chr \"Date/Time of End of Participation\" $ DTHDTC : chr [1:306] NA NA NA NA ... ..- attr(*, \"label\")= chr \"Date/Time of Death\" $ DTHFL : chr [1:306] NA NA NA NA ... ..- attr(*, \"label\")= chr \"Subject Death Flag\" $ SITEID : chr [1:306] \"701\" \"701\" \"701\" \"701\" ... ..- attr(*, \"label\")= chr \"Study Site Identifier\" $ AGE : num [1:306] 63 64 71 74 77 85 59 68 81 84 ... ..- attr(*, \"label\")= chr \"Age\" $ AGEU : chr [1:306] \"YEARS\" \"YEARS\" \"YEARS\" \"YEARS\" ... ..- attr(*, \"label\")= chr \"Age Units\" $ SEX : chr [1:306] \"F\" \"M\" \"M\" \"M\" ... ..- attr(*, \"label\")= chr \"Sex\" $ RACE : chr [1:306] \"WHITE\" \"WHITE\" \"WHITE\" \"WHITE\" ... ..- attr(*, \"label\")= chr \"Race\" $ ETHNIC : chr [1:306] \"HISPANIC OR LATINO\" \"HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" ... ..- attr(*, \"label\")= chr \"Ethnicity\" $ ARMCD : chr [1:306] \"Pbo\" \"Pbo\" \"Xan_Hi\" \"Xan_Lo\" ... ..- attr(*, \"label\")= chr \"Planned Arm Code\" $ ARM : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Planned Arm\" $ ACTARMCD: chr [1:306] \"Pbo\" \"Pbo\" \"Xan_Hi\" \"Xan_Lo\" ... ..- attr(*, \"label\")= chr \"Actual Arm Code\" $ ACTARM : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Actual Arm\" $ COUNTRY : chr [1:306] \"USA\" \"USA\" \"USA\" \"USA\" ... ..- attr(*, \"label\")= chr \"Country\" $ DMDTC : chr [1:306] \"2013-12-26\" \"2012-07-22\" \"2013-07-11\" \"2014-03-10\" ... ..- attr(*, \"label\")= chr \"Date/Time of Collection\" $ DMDY : num [1:306] -7 -14 -8 -8 -7 -21 NA -9 -13 -7 ... ..- attr(*, \"label\")= chr \"Study Day of Collection\" $ TRT01P : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Planned Arm\" $ TRT01A : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Actual Arm\" $ TRTSDTM : POSIXct[1:306], format: \"2014-01-02\" ... $ TRTSTMF : chr [1:306] \"H\" \"H\" \"H\" \"H\" ... $ TRTEDTM : POSIXct[1:306], format: \"2014-07-02 23:59:59\" ... $ TRTETMF : chr [1:306] \"H\" \"H\" \"H\" \"H\" ... $ TRTSDT : Date[1:306], format: \"2014-01-02\" ... $ TRTEDT : Date[1:306], format: \"2014-07-02\" ... $ TRTDURD : num [1:306] 182 28 180 14 183 26 NA 190 10 55 ... $ SCRFDT : Date[1:306], format: NA ... $ EOSDT : Date[1:306], format: \"2014-07-02\" ... $ EOSSTT : chr [1:306] \"COMPLETED\" \"DISCONTINUED\" \"COMPLETED\" \"DISCONTINUED\" ... $ FRVDT : Date[1:306], format: NA ... $ RANDDT : Date[1:306], format: \"2014-01-02\" ... $ DTHDT : Date[1:306], format: NA ... $ DTHADY : num [1:306] NA NA NA NA NA NA NA NA NA NA ... $ LDDTHELD: num [1:306] NA NA NA NA NA NA NA NA NA NA ... $ LSTALVDT: num [1:306] 16253 15585 16084 16174 16434 ... $ AGEGR1 : chr [1:306] \"18-64\" \"18-64\" \">=65\" \">=65\" ... $ SAFFL : chr [1:306] \"Y\" \"Y\" \"Y\" \"Y\" ... $ RACEGR1 : chr [1:306] \"White\" \"White\" \"White\" \"White\" ... $ REGION1 : chr [1:306] \"NA\" \"NA\" \"NA\" \"NA\" ... $ LDDTHGR1: chr [1:306] NA NA NA NA ... $ DTH30FL : chr [1:306] NA NA NA NA ... $ DTHA30FL: chr [1:306] NA NA NA NA ... $ DTHB30FL: chr [1:306] NA NA NA NA ... - attr(*, \"_xportr.df_arg_\")= chr \"ADSL\""},{"path":"https://atorus-research.github.io/xportr/dev/articles/xportr.html","id":"xportr_length","dir":"Articles","previous_headings":"","what":"xportr_length()","title":"Getting Started","text":"Next can apply lengths variable level specification file data frame. xportr_length() identify variables missing specification file. function also alert many lengths applied successfully. apply lengths lets verify lengths applied original dataframe. lengths applied variables seen printout - lengths attr() part variables. Let’s now use xportr_length() apply lengths specification file. Note additional attr(*, \"width\")= variable width. directly applied specification file loaded !","code":"tibble [306 × 50] (S3: tbl_df/tbl/data.frame) $ STUDYID : chr [1:306] \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" ... ..- attr(*, \"label\")= chr \"Study Identifier\" $ USUBJID : chr [1:306] \"01-701-1015\" \"01-701-1023\" \"01-701-1028\" \"01-701-1033\" ... ..- attr(*, \"label\")= chr \"Unique Subject Identifier\" $ SUBJID : chr [1:306] \"1015\" \"1023\" \"1028\" \"1033\" ... ..- attr(*, \"label\")= chr \"Subject Identifier for the Study\" $ RFSTDTC : chr [1:306] \"2014-01-02\" \"2012-08-05\" \"2013-07-19\" \"2014-03-18\" ... ..- attr(*, \"label\")= chr \"Subject Reference Start Date/Time\" $ RFENDTC : chr [1:306] \"2014-07-02\" \"2012-09-02\" \"2014-01-14\" \"2014-04-14\" ... ..- attr(*, \"label\")= chr \"Subject Reference End Date/Time\" $ RFXSTDTC: chr [1:306] \"2014-01-02\" \"2012-08-05\" \"2013-07-19\" \"2014-03-18\" ... ..- attr(*, \"label\")= chr \"Date/Time of First Study Treatment\" $ RFXENDTC: chr [1:306] \"2014-07-02\" \"2012-09-01\" \"2014-01-14\" \"2014-03-31\" ... ..- attr(*, \"label\")= chr \"Date/Time of Last Study Treatment\" $ RFICDTC : chr [1:306] NA NA NA NA ... ..- attr(*, \"label\")= chr \"Date/Time of Informed Consent\" $ RFPENDTC: chr [1:306] \"2014-07-02T11:45\" \"2013-02-18\" \"2014-01-14T11:10\" \"2014-09-15\" ... ..- attr(*, \"label\")= chr \"Date/Time of End of Participation\" $ DTHDTC : chr [1:306] NA NA NA NA ... ..- attr(*, \"label\")= chr \"Date/Time of Death\" $ DTHFL : chr [1:306] NA NA NA NA ... ..- attr(*, \"label\")= chr \"Subject Death Flag\" $ SITEID : chr [1:306] \"701\" \"701\" \"701\" \"701\" ... ..- attr(*, \"label\")= chr \"Study Site Identifier\" $ AGE : num [1:306] 63 64 71 74 77 85 59 68 81 84 ... ..- attr(*, \"label\")= chr \"Age\" $ AGEU : chr [1:306] \"YEARS\" \"YEARS\" \"YEARS\" \"YEARS\" ... ..- attr(*, \"label\")= chr \"Age Units\" $ SEX : chr [1:306] \"F\" \"M\" \"M\" \"M\" ... ..- attr(*, \"label\")= chr \"Sex\" $ RACE : chr [1:306] \"WHITE\" \"WHITE\" \"WHITE\" \"WHITE\" ... ..- attr(*, \"label\")= chr \"Race\" $ ETHNIC : chr [1:306] \"HISPANIC OR LATINO\" \"HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" ... ..- attr(*, \"label\")= chr \"Ethnicity\" $ ARMCD : chr [1:306] \"Pbo\" \"Pbo\" \"Xan_Hi\" \"Xan_Lo\" ... ..- attr(*, \"label\")= chr \"Planned Arm Code\" $ ARM : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Planned Arm\" $ ACTARMCD: chr [1:306] \"Pbo\" \"Pbo\" \"Xan_Hi\" \"Xan_Lo\" ... ..- attr(*, \"label\")= chr \"Actual Arm Code\" $ ACTARM : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Actual Arm\" $ COUNTRY : chr [1:306] \"USA\" \"USA\" \"USA\" \"USA\" ... ..- attr(*, \"label\")= chr \"Country\" $ DMDTC : chr [1:306] \"2013-12-26\" \"2012-07-22\" \"2013-07-11\" \"2014-03-10\" ... ..- attr(*, \"label\")= chr \"Date/Time of Collection\" $ DMDY : num [1:306] -7 -14 -8 -8 -7 -21 NA -9 -13 -7 ... ..- attr(*, \"label\")= chr \"Study Day of Collection\" $ TRT01P : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Planned Arm\" $ TRT01A : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Actual Arm\" $ TRTSDTM : POSIXct[1:306], format: \"2014-01-02\" ... $ TRTSTMF : chr [1:306] \"H\" \"H\" \"H\" \"H\" ... $ TRTEDTM : POSIXct[1:306], format: \"2014-07-02 23:59:59\" ... $ TRTETMF : chr [1:306] \"H\" \"H\" \"H\" \"H\" ... $ TRTSDT : Date[1:306], format: \"2014-01-02\" ... $ TRTEDT : Date[1:306], format: \"2014-07-02\" ... $ TRTDURD : num [1:306] 182 28 180 14 183 26 NA 190 10 55 ... $ SCRFDT : Date[1:306], format: NA ... $ EOSDT : Date[1:306], format: \"2014-07-02\" ... $ EOSSTT : chr [1:306] \"COMPLETED\" \"DISCONTINUED\" \"COMPLETED\" \"DISCONTINUED\" ... $ FRVDT : Date[1:306], format: NA ... $ RANDDT : Date[1:306], format: \"2014-01-02\" ... $ DTHDT : Date[1:306], format: NA ... $ DTHADY : num [1:306] NA NA NA NA NA NA NA NA NA NA ... $ LDDTHELD: num [1:306] NA NA NA NA NA NA NA NA NA NA ... $ LSTALVDT: Date[1:306], format: \"2014-07-02\" ... $ AGEGR1 : Factor w/ 3 levels \"<18\",\"18-64\",..: 2 2 3 3 3 3 2 3 3 3 ... $ SAFFL : chr [1:306] \"Y\" \"Y\" \"Y\" \"Y\" ... $ RACEGR1 : chr [1:306] \"White\" \"White\" \"White\" \"White\" ... $ REGION1 : chr [1:306] \"NA\" \"NA\" \"NA\" \"NA\" ... $ LDDTHGR1: chr [1:306] NA NA NA NA ... $ DTH30FL : chr [1:306] NA NA NA NA ... $ DTHA30FL: chr [1:306] NA NA NA NA ... $ DTHB30FL: chr [1:306] NA NA NA NA ... adsl_length <- adsl %>% xportr_length(var_spec, domain = \"ADSL\", verbose = \"message\") ── Variable lengths missing from metadata. ── ✔ 3 lengths resolved Variable(s) present in dataframe but doesn't exist in `metadata`.Problem with `TRTSTMF`, `TRTETMF`, and `RANDDT` tibble [306 × 50] (S3: tbl_df/tbl/data.frame) $ STUDYID : chr [1:306] \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" ... ..- attr(*, \"label\")= chr \"Study Identifier\" ..- attr(*, \"width\")= num 21 $ USUBJID : chr [1:306] \"01-701-1015\" \"01-701-1023\" \"01-701-1028\" \"01-701-1033\" ... ..- attr(*, \"label\")= chr \"Unique Subject Identifier\" ..- attr(*, \"width\")= num 30 $ SUBJID : chr [1:306] \"1015\" \"1023\" \"1028\" \"1033\" ... ..- attr(*, \"label\")= chr \"Subject Identifier for the Study\" ..- attr(*, \"width\")= num 8 $ RFSTDTC : chr [1:306] \"2014-01-02\" \"2012-08-05\" \"2013-07-19\" \"2014-03-18\" ... ..- attr(*, \"label\")= chr \"Subject Reference Start Date/Time\" ..- attr(*, \"width\")= num 19 $ RFENDTC : chr [1:306] \"2014-07-02\" \"2012-09-02\" \"2014-01-14\" \"2014-04-14\" ... ..- attr(*, \"label\")= chr \"Subject Reference End Date/Time\" ..- attr(*, \"width\")= num 19 $ RFXSTDTC: chr [1:306] \"2014-01-02\" \"2012-08-05\" \"2013-07-19\" \"2014-03-18\" ... ..- attr(*, \"label\")= chr \"Date/Time of First Study Treatment\" ..- attr(*, \"width\")= num 19 $ RFXENDTC: chr [1:306] \"2014-07-02\" \"2012-09-01\" \"2014-01-14\" \"2014-03-31\" ... ..- attr(*, \"label\")= chr \"Date/Time of Last Study Treatment\" ..- attr(*, \"width\")= num 19 $ RFICDTC : chr [1:306] NA NA NA NA ... ..- attr(*, \"label\")= chr \"Date/Time of Informed Consent\" ..- attr(*, \"width\")= num 19 $ RFPENDTC: chr [1:306] \"2014-07-02T11:45\" \"2013-02-18\" \"2014-01-14T11:10\" \"2014-09-15\" ... ..- attr(*, \"label\")= chr \"Date/Time of End of Participation\" ..- attr(*, \"width\")= num 19 $ DTHDTC : chr [1:306] NA NA NA NA ... ..- attr(*, \"label\")= chr \"Date/Time of Death\" ..- attr(*, \"width\")= num 19 $ DTHFL : chr [1:306] NA NA NA NA ... ..- attr(*, \"label\")= chr \"Subject Death Flag\" ..- attr(*, \"width\")= num 2 $ SITEID : chr [1:306] \"701\" \"701\" \"701\" \"701\" ... ..- attr(*, \"label\")= chr \"Study Site Identifier\" ..- attr(*, \"width\")= num 5 $ AGE : num [1:306] 63 64 71 74 77 85 59 68 81 84 ... ..- attr(*, \"label\")= chr \"Age\" ..- attr(*, \"width\")= num 8 $ AGEU : chr [1:306] \"YEARS\" \"YEARS\" \"YEARS\" \"YEARS\" ... ..- attr(*, \"label\")= chr \"Age Units\" ..- attr(*, \"width\")= num 10 $ SEX : chr [1:306] \"F\" \"M\" \"M\" \"M\" ... ..- attr(*, \"label\")= chr \"Sex\" ..- attr(*, \"width\")= num 1 $ RACE : chr [1:306] \"WHITE\" \"WHITE\" \"WHITE\" \"WHITE\" ... ..- attr(*, \"label\")= chr \"Race\" ..- attr(*, \"width\")= num 60 $ ETHNIC : chr [1:306] \"HISPANIC OR LATINO\" \"HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" ... ..- attr(*, \"label\")= chr \"Ethnicity\" ..- attr(*, \"width\")= num 100 $ ARMCD : chr [1:306] \"Pbo\" \"Pbo\" \"Xan_Hi\" \"Xan_Lo\" ... ..- attr(*, \"label\")= chr \"Planned Arm Code\" ..- attr(*, \"width\")= num 20 $ ARM : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Planned Arm\" ..- attr(*, \"width\")= num 200 $ ACTARMCD: chr [1:306] \"Pbo\" \"Pbo\" \"Xan_Hi\" \"Xan_Lo\" ... ..- attr(*, \"label\")= chr \"Actual Arm Code\" ..- attr(*, \"width\")= num 20 $ ACTARM : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Actual Arm\" ..- attr(*, \"width\")= num 200 $ COUNTRY : chr [1:306] \"USA\" \"USA\" \"USA\" \"USA\" ... ..- attr(*, \"label\")= chr \"Country\" ..- attr(*, \"width\")= num 3 $ DMDTC : chr [1:306] \"2013-12-26\" \"2012-07-22\" \"2013-07-11\" \"2014-03-10\" ... ..- attr(*, \"label\")= chr \"Date/Time of Collection\" ..- attr(*, \"width\")= num 19 $ DMDY : num [1:306] -7 -14 -8 -8 -7 -21 NA -9 -13 -7 ... ..- attr(*, \"label\")= chr \"Study Day of Collection\" ..- attr(*, \"width\")= num 8 $ TRT01P : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Planned Arm\" ..- attr(*, \"width\")= num 40 $ TRT01A : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Actual Arm\" ..- attr(*, \"width\")= num 40 $ TRTSDTM : POSIXct[1:306], format: \"2014-01-02\" ... $ TRTSTMF : chr [1:306] \"H\" \"H\" \"H\" \"H\" ... ..- attr(*, \"width\")= num 200 $ TRTEDTM : POSIXct[1:306], format: \"2014-07-02 23:59:59\" ... $ TRTETMF : chr [1:306] \"H\" \"H\" \"H\" \"H\" ... ..- attr(*, \"width\")= num 200 $ TRTSDT : Date[1:306], format: \"2014-01-02\" ... $ TRTEDT : Date[1:306], format: \"2014-07-02\" ... $ TRTDURD : num [1:306] 182 28 180 14 183 26 NA 190 10 55 ... ..- attr(*, \"width\")= num 8 $ SCRFDT : Date[1:306], format: NA ... $ EOSDT : Date[1:306], format: \"2014-07-02\" ... $ EOSSTT : chr [1:306] \"COMPLETED\" \"DISCONTINUED\" \"COMPLETED\" \"DISCONTINUED\" ... ..- attr(*, \"width\")= num 200 $ FRVDT : Date[1:306], format: NA ... $ RANDDT : Date[1:306], format: \"2014-01-02\" ... $ DTHDT : Date[1:306], format: NA ... $ DTHADY : num [1:306] NA NA NA NA NA NA NA NA NA NA ... ..- attr(*, \"width\")= num 8 $ LDDTHELD: num [1:306] NA NA NA NA NA NA NA NA NA NA ... ..- attr(*, \"width\")= num 8 $ LSTALVDT: Date[1:306], format: \"2014-07-02\" ... $ AGEGR1 : Factor w/ 3 levels \"<18\",\"18-64\",..: 2 2 3 3 3 3 2 3 3 3 ... ..- attr(*, \"width\")= num 20 $ SAFFL : chr [1:306] \"Y\" \"Y\" \"Y\" \"Y\" ... ..- attr(*, \"width\")= num 2 $ RACEGR1 : chr [1:306] \"White\" \"White\" \"White\" \"White\" ... ..- attr(*, \"width\")= num 200 $ REGION1 : chr [1:306] \"NA\" \"NA\" \"NA\" \"NA\" ... ..- attr(*, \"width\")= num 80 $ LDDTHGR1: chr [1:306] NA NA NA NA ... ..- attr(*, \"width\")= num 200 $ DTH30FL : chr [1:306] NA NA NA NA ... ..- attr(*, \"width\")= num 200 $ DTHA30FL: chr [1:306] NA NA NA NA ... ..- attr(*, \"width\")= num 200 $ DTHB30FL: chr [1:306] NA NA NA NA ... ..- attr(*, \"width\")= num 200 - attr(*, \"_xportr.df_arg_\")= chr \"ADSL\""},{"path":"https://atorus-research.github.io/xportr/dev/articles/xportr.html","id":"xportr_order","dir":"Articles","previous_headings":"","what":"xportr_order()","title":"Getting Started","text":"Please note order ADSL variables, see , match specification file order column. can quickly remedy call xportr_order(). Note variable SITEID moved well many others match specification file order column. Variables spec moved end data message written console.","code":"adsl_order <- xportr_order(adsl, var_spec, domain = \"ADSL\", verbose = \"message\") ── 3 variables not in spec and moved to end ── Variable moved to end in `.df`: `TRTSTMF`, `TRTETMF`, and `RANDDT` ── 48 reordered in dataset ── Variable reordered in `.df`: `SITEID`, `USUBJID`, `SUBJID`, `COUNTRY`, `AGE`, `AGEU`, `AGEGR1`, `SEX`, `RACE`, `RACEGR1`, `ETHNIC`, `RFSTDTC`, `RFENDTC`, `RFXSTDTC`, `RFXENDTC`, `RFICDTC`, `RFPENDTC`, `DMDTC`, `DMDY`, `SAFFL`, `ARM`, `ARMCD`, `ACTARM`, `ACTARMCD`, `TRT01P`, `TRT01A`, `TRTSDTM`, `TRTSDT`, `TRTEDT`, `DTHFL`, `DTHDTC`, `DTHDT`, `DTHADY`, `REGION1`, `TRTDURD`, `LDDTHELD`, `LSTALVDT`, `LDDTHGR1`, `DTH30FL`, `DTHA30FL`, `DTHB30FL`, `FRVDT`, `SCRFDT`, `EOSDT`, `EOSSTT`, `TRTSTMF`, `TRTETMF`, and `RANDDT`"},{"path":"https://atorus-research.github.io/xportr/dev/articles/xportr.html","id":"xportr_format","dir":"Articles","previous_headings":"","what":"xportr_format()","title":"Getting Started","text":"Now apply formats dataset. typically DATE9., DATETIME20 TIME5, many others can used. Notice ADSL dataset 8 Date/Time variables missing formats. just take peak TRT variables, NULL format. Using xportr_format() can apply formats dataset. NOTE: can use attr(data$variable, = \"format\") inspect formats applied dataframe. output individual calls bound together easier viewing.","code":"# A tibble: 4 × 2 Variable Format 1 TRTSDT 2 TRTEDT 3 TRTSDTM 4 TRTEDTM adsl_fmt <- adsl %>% xportr_format(var_spec, domain = \"ADSL\") # A tibble: 4 × 2 Variable Format 1 TRTSDT DATE9. 2 TRTEDT DATE9. 3 TRTSDTM DATETIME20. 4 TRTEDTM DATETIME20."},{"path":"https://atorus-research.github.io/xportr/dev/articles/xportr.html","id":"xportr_label","dir":"Articles","previous_headings":"","what":"xportr_label()","title":"Getting Started","text":"Please observe ADSL dataset missing many variable labels. Sometimes labels can lost using R’s function. However, CDISC compliant data set needs variable label. Using xport_label function can take specifications file label variables available. xportr_label produce warning message variable data set specification file.","code":"tibble [306 × 50] (S3: tbl_df/tbl/data.frame) $ STUDYID : chr [1:306] \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" ... $ USUBJID : chr [1:306] \"01-701-1015\" \"01-701-1023\" \"01-701-1028\" \"01-701-1033\" ... $ SUBJID : chr [1:306] \"1015\" \"1023\" \"1028\" \"1033\" ... $ RFSTDTC : chr [1:306] \"2014-01-02\" \"2012-08-05\" \"2013-07-19\" \"2014-03-18\" ... $ RFENDTC : chr [1:306] \"2014-07-02\" \"2012-09-02\" \"2014-01-14\" \"2014-04-14\" ... $ RFXSTDTC: chr [1:306] \"2014-01-02\" \"2012-08-05\" \"2013-07-19\" \"2014-03-18\" ... $ RFXENDTC: chr [1:306] \"2014-07-02\" \"2012-09-01\" \"2014-01-14\" \"2014-03-31\" ... $ RFICDTC : chr [1:306] NA NA NA NA ... $ RFPENDTC: chr [1:306] \"2014-07-02T11:45\" \"2013-02-18\" \"2014-01-14T11:10\" \"2014-09-15\" ... $ DTHDTC : chr [1:306] NA NA NA NA ... $ DTHFL : chr [1:306] NA NA NA NA ... $ SITEID : chr [1:306] \"701\" \"701\" \"701\" \"701\" ... $ AGE : num [1:306] 63 64 71 74 77 85 59 68 81 84 ... $ AGEU : chr [1:306] \"YEARS\" \"YEARS\" \"YEARS\" \"YEARS\" ... $ SEX : chr [1:306] \"F\" \"M\" \"M\" \"M\" ... $ RACE : chr [1:306] \"WHITE\" \"WHITE\" \"WHITE\" \"WHITE\" ... $ ETHNIC : chr [1:306] \"HISPANIC OR LATINO\" \"HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" ... $ ARMCD : chr [1:306] \"Pbo\" \"Pbo\" \"Xan_Hi\" \"Xan_Lo\" ... $ ARM : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... $ ACTARMCD: chr [1:306] \"Pbo\" \"Pbo\" \"Xan_Hi\" \"Xan_Lo\" ... $ ACTARM : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... $ COUNTRY : chr [1:306] \"USA\" \"USA\" \"USA\" \"USA\" ... $ DMDTC : chr [1:306] \"2013-12-26\" \"2012-07-22\" \"2013-07-11\" \"2014-03-10\" ... $ DMDY : num [1:306] -7 -14 -8 -8 -7 -21 NA -9 -13 -7 ... $ TRT01P : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... $ TRT01A : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... $ TRTSDTM : POSIXct[1:306], format: \"2014-01-02\" ... $ TRTSTMF : chr [1:306] \"H\" \"H\" \"H\" \"H\" ... $ TRTEDTM : POSIXct[1:306], format: \"2014-07-02 23:59:59\" ... $ TRTETMF : chr [1:306] \"H\" \"H\" \"H\" \"H\" ... $ TRTSDT : Date[1:306], format: \"2014-01-02\" ... $ TRTEDT : Date[1:306], format: \"2014-07-02\" ... $ TRTDURD : num [1:306] 182 28 180 14 183 26 NA 190 10 55 ... $ SCRFDT : Date[1:306], format: NA ... $ EOSDT : Date[1:306], format: \"2014-07-02\" ... $ EOSSTT : chr [1:306] \"COMPLETED\" \"DISCONTINUED\" \"COMPLETED\" \"DISCONTINUED\" ... $ FRVDT : Date[1:306], format: NA ... $ RANDDT : Date[1:306], format: \"2014-01-02\" ... $ DTHDT : Date[1:306], format: NA ... $ DTHADY : num [1:306] NA NA NA NA NA NA NA NA NA NA ... $ LDDTHELD: num [1:306] NA NA NA NA NA NA NA NA NA NA ... $ LSTALVDT: Date[1:306], format: \"2014-07-02\" ... $ AGEGR1 : Factor w/ 3 levels \"<18\",\"18-64\",..: 2 2 3 3 3 3 2 3 3 3 ... $ SAFFL : chr [1:306] \"Y\" \"Y\" \"Y\" \"Y\" ... $ RACEGR1 : chr [1:306] \"White\" \"White\" \"White\" \"White\" ... $ REGION1 : chr [1:306] \"NA\" \"NA\" \"NA\" \"NA\" ... $ LDDTHGR1: chr [1:306] NA NA NA NA ... $ DTH30FL : chr [1:306] NA NA NA NA ... $ DTHA30FL: chr [1:306] NA NA NA NA ... $ DTHB30FL: chr [1:306] NA NA NA NA ... adsl_lbl <- adsl %>% xportr_label(var_spec, domain = \"ADSL\", \"message\") ── Variable labels missing from metadata. ── ✔ 3 labels skipped Variable(s) present in dataframe but doesn't exist in `metadata`. ✖ Problem with `TRTSTMF`, `TRTETMF`, and `RANDDT` str(adsl_lbl) tibble [306 × 50] (S3: tbl_df/tbl/data.frame) $ STUDYID : chr [1:306] \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" ... ..- attr(*, \"label\")= chr \"Study Identifier\" $ USUBJID : chr [1:306] \"01-701-1015\" \"01-701-1023\" \"01-701-1028\" \"01-701-1033\" ... ..- attr(*, \"label\")= chr \"Unique Subject Identifier\" $ SUBJID : chr [1:306] \"1015\" \"1023\" \"1028\" \"1033\" ... ..- attr(*, \"label\")= chr \"Subject Identifier for the Study\" $ RFSTDTC : chr [1:306] \"2014-01-02\" \"2012-08-05\" \"2013-07-19\" \"2014-03-18\" ... ..- attr(*, \"label\")= chr \"Subject Reference Start Date/Time\" $ RFENDTC : chr [1:306] \"2014-07-02\" \"2012-09-02\" \"2014-01-14\" \"2014-04-14\" ... ..- attr(*, \"label\")= chr \"Subject Reference End Date/Time\" $ RFXSTDTC: chr [1:306] \"2014-01-02\" \"2012-08-05\" \"2013-07-19\" \"2014-03-18\" ... ..- attr(*, \"label\")= chr \"Date/Time of First Study Treatment\" $ RFXENDTC: chr [1:306] \"2014-07-02\" \"2012-09-01\" \"2014-01-14\" \"2014-03-31\" ... ..- attr(*, \"label\")= chr \"Date/Time of Last Study Treatment\" $ RFICDTC : chr [1:306] NA NA NA NA ... ..- attr(*, \"label\")= chr \"Date/Time of Informed Consent\" $ RFPENDTC: chr [1:306] \"2014-07-02T11:45\" \"2013-02-18\" \"2014-01-14T11:10\" \"2014-09-15\" ... ..- attr(*, \"label\")= chr \"Date/Time of End of Participation\" $ DTHDTC : chr [1:306] NA NA NA NA ... ..- attr(*, \"label\")= chr \"Date / Time of Death\" $ DTHFL : chr [1:306] NA NA NA NA ... ..- attr(*, \"label\")= chr \"Subject Death Flag\" $ SITEID : chr [1:306] \"701\" \"701\" \"701\" \"701\" ... ..- attr(*, \"label\")= chr \"Study Site Identifier\" $ AGE : num [1:306] 63 64 71 74 77 85 59 68 81 84 ... ..- attr(*, \"label\")= chr \"Age\" $ AGEU : chr [1:306] \"YEARS\" \"YEARS\" \"YEARS\" \"YEARS\" ... ..- attr(*, \"label\")= chr \"Age Units\" $ SEX : chr [1:306] \"F\" \"M\" \"M\" \"M\" ... ..- attr(*, \"label\")= chr \"Sex\" $ RACE : chr [1:306] \"WHITE\" \"WHITE\" \"WHITE\" \"WHITE\" ... ..- attr(*, \"label\")= chr \"Race\" $ ETHNIC : chr [1:306] \"HISPANIC OR LATINO\" \"HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" ... ..- attr(*, \"label\")= chr \"Ethnicity\" $ ARMCD : chr [1:306] \"Pbo\" \"Pbo\" \"Xan_Hi\" \"Xan_Lo\" ... ..- attr(*, \"label\")= chr \"Planned Arm Code\" $ ARM : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Planned Arm\" $ ACTARMCD: chr [1:306] \"Pbo\" \"Pbo\" \"Xan_Hi\" \"Xan_Lo\" ... ..- attr(*, \"label\")= chr \"Actual Arm Code\" $ ACTARM : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Actual Arm\" $ COUNTRY : chr [1:306] \"USA\" \"USA\" \"USA\" \"USA\" ... ..- attr(*, \"label\")= chr \"Country\" $ DMDTC : chr [1:306] \"2013-12-26\" \"2012-07-22\" \"2013-07-11\" \"2014-03-10\" ... ..- attr(*, \"label\")= chr \"Date/Time of Collection\" $ DMDY : num [1:306] -7 -14 -8 -8 -7 -21 NA -9 -13 -7 ... ..- attr(*, \"label\")= chr \"Study Day of Collection\" $ TRT01P : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Planned Treatment for Period 01\" $ TRT01A : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Actual Treatment for Period 01\" $ TRTSDTM : POSIXct[1:306], format: \"2014-01-02\" ... $ TRTSTMF : chr [1:306] \"H\" \"H\" \"H\" \"H\" ... ..- attr(*, \"label\")= chr \"\" $ TRTEDTM : POSIXct[1:306], format: \"2014-07-02 23:59:59\" ... $ TRTETMF : chr [1:306] \"H\" \"H\" \"H\" \"H\" ... ..- attr(*, \"label\")= chr \"\" $ TRTSDT : Date[1:306], format: \"2014-01-02\" ... $ TRTEDT : Date[1:306], format: \"2014-07-02\" ... $ TRTDURD : num [1:306] 182 28 180 14 183 26 NA 190 10 55 ... ..- attr(*, \"label\")= chr \"Total Duration of Trt (days)\" $ SCRFDT : Date[1:306], format: NA ... $ EOSDT : Date[1:306], format: \"2014-07-02\" ... $ EOSSTT : chr [1:306] \"COMPLETED\" \"DISCONTINUED\" \"COMPLETED\" \"DISCONTINUED\" ... ..- attr(*, \"label\")= chr \"End of Study Status\" $ FRVDT : Date[1:306], format: NA ... $ RANDDT : Date[1:306], format: \"2014-01-02\" ... $ DTHDT : Date[1:306], format: NA ... $ DTHADY : num [1:306] NA NA NA NA NA NA NA NA NA NA ... ..- attr(*, \"label\")= chr \"Relative Day of Death\" $ LDDTHELD: num [1:306] NA NA NA NA NA NA NA NA NA NA ... ..- attr(*, \"label\")= chr \"Elapsed Days from Last Dose to Death\" $ LSTALVDT: Date[1:306], format: \"2014-07-02\" ... $ AGEGR1 : Factor w/ 3 levels \"<18\",\"18-64\",..: 2 2 3 3 3 3 2 3 3 3 ... ..- attr(*, \"label\")= chr \"Pooled Age Group 1\" $ SAFFL : chr [1:306] \"Y\" \"Y\" \"Y\" \"Y\" ... ..- attr(*, \"label\")= chr \"Safety Population Flag\" $ RACEGR1 : chr [1:306] \"White\" \"White\" \"White\" \"White\" ... ..- attr(*, \"label\")= chr \"Pooled Race Group 1\" $ REGION1 : chr [1:306] \"NA\" \"NA\" \"NA\" \"NA\" ... ..- attr(*, \"label\")= chr \"Geographic Region 1\" $ LDDTHGR1: chr [1:306] NA NA NA NA ... ..- attr(*, \"label\")= chr \"Last Does to Death Group\" $ DTH30FL : chr [1:306] NA NA NA NA ... ..- attr(*, \"label\")= chr \"Under 30 Group\" $ DTHA30FL: chr [1:306] NA NA NA NA ... ..- attr(*, \"label\")= chr \"Over 30 Group\" $ DTHB30FL: chr [1:306] NA NA NA NA ... ..- attr(*, \"label\")= chr \"Over 30 plus 30 days Group\" - attr(*, \"_xportr.df_arg_\")= chr \"ADSL\""},{"path":"https://atorus-research.github.io/xportr/dev/articles/xportr.html","id":"xportr_write","dir":"Articles","previous_headings":"","what":"xportr_write()","title":"Getting Started","text":"Finally, arrive exporting R data frame object xpt file xportr_write(). xpt file written directly current working directory. make interesting, put together six functions magrittr pipe, %>%. user can now apply types, length, variable labels, formats, data set label write final xpt file one pipe! Appropriate warnings messages supplied user console potential issues sending standard clinical data set validator application data reviewers. ’s ! now xpt file created R appropriate types, lengths, labels, ordering formats specification file. interested exploring custom warnings error messages well background xpt generation sure check Deep Dive User Guide. always, welcome feedback. spot bug, like see new feature, documentation unclear - submit issue xportr’s GitHub page.","code":"adsl %>% xportr_type(var_spec, \"ADSL\", \"message\") %>% xportr_length(var_spec, \"ADSL\", verbose = \"message\") %>% xportr_label(var_spec, \"ADSL\", \"message\") %>% xportr_order(var_spec, \"ADSL\", \"message\") %>% xportr_format(var_spec, \"ADSL\") %>% xportr_write(\"adsl.xpt\") ── Variable type mismatches found. ── ✔ 2 variables coerced Variable type(s) in dataframe don't match metadata: `LSTALVDT` and `AGEGR1` ── Variable lengths missing from metadata. ── ✔ 3 lengths resolved Variable(s) present in dataframe but doesn't exist in `metadata`.Problem with `TRTSTMF`, `TRTETMF`, and `RANDDT` ── Variable labels missing from metadata. ── ✔ 3 labels skipped Variable(s) present in dataframe but doesn't exist in `metadata`. ✖ Problem with `TRTSTMF`, `TRTETMF`, and `RANDDT` ── 3 variables not in spec and moved to end ── Variable moved to end in `.df`: `TRTSTMF`, `TRTETMF`, and `RANDDT` ── 48 reordered in dataset ── Variable reordered in `.df`: `SITEID`, `USUBJID`, `SUBJID`, `COUNTRY`, `AGE`, `AGEU`, `AGEGR1`, `SEX`, `RACE`, `RACEGR1`, `ETHNIC`, `RFSTDTC`, `RFENDTC`, `RFXSTDTC`, `RFXENDTC`, `RFICDTC`, `RFPENDTC`, `DMDTC`, `DMDY`, `SAFFL`, `ARM`, `ARMCD`, `ACTARM`, `ACTARMCD`, `TRT01P`, `TRT01A`, `TRTSDTM`, `TRTSDT`, `TRTEDT`, `DTHFL`, `DTHDTC`, `DTHDT`, `DTHADY`, `REGION1`, `TRTDURD`, `LDDTHELD`, `LSTALVDT`, `LDDTHGR1`, `DTH30FL`, `DTHA30FL`, `DTHB30FL`, `FRVDT`, `SCRFDT`, `EOSDT`, `EOSSTT`, `TRTSTMF`, `TRTETMF`, and `RANDDT`"},{"path":"https://atorus-research.github.io/xportr/dev/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Eli Miller. Author, maintainer. Vignesh Thanikachalam. Author. Ben Straub. Author. Ross Didenko. Author. Zelos Zhu. Author. Ethan Brockmann. Author. Vedha Viyash. Author. Andre Verissimo. Author. Sophie Shapcott. Author. Celine Piraux. Author. Adrian Chan. Author. Sadchla Mascary. Author. Atorus/GSK JPT. Copyright holder.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Miller E, Thanikachalam V, Straub B, Didenko R, Zhu Z, Brockmann E, Viyash V, Verissimo , Shapcott S, Piraux C, Chan , Mascary S (2024). xportr: Utilities Output CDISC SDTM/ADaM XPT Files. R package version 0.3.1.9015, https://github.com/atorus-research/xportr.","code":"@Manual{, title = {xportr: Utilities to Output CDISC SDTM/ADaM XPT Files}, author = {Eli Miller and Vignesh Thanikachalam and Ben Straub and Ross Didenko and Zelos Zhu and Ethan Brockmann and Vedha Viyash and Andre Verissimo and Sophie Shapcott and Celine Piraux and Adrian Chan and Sadchla Mascary}, year = {2024}, note = {R package version 0.3.1.9015}, url = {https://github.com/atorus-research/xportr}, }"},{"path":"https://atorus-research.github.io/xportr/dev/index.html","id":"xportr-","dir":"","previous_headings":"","what":"Utilities to Output CDISC SDTM/ADaM XPT Files","title":"Utilities to Output CDISC SDTM/ADaM XPT Files","text":"Welcome xportr! designed xportr help get xpt files ready transport either clinical data set validator application regulatory agency. package functionality associate metadata information local R data frame, perform data set level validation checks convert transport v5 file(xpt). always, welcome feedback. spot bug, like see new feature, documentation unclear - submit issue xportr’s GitHub page.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Utilities to Output CDISC SDTM/ADaM XPT Files","text":"package available CRAN can installed running:","code":"install.packages(\"xportr\")"},{"path":"https://atorus-research.github.io/xportr/dev/index.html","id":"development-version","dir":"","previous_headings":"Installation","what":"Development version:","title":"Utilities to Output CDISC SDTM/ADaM XPT Files","text":"","code":"devtools::install_github(\"https://github.com/atorus-research/xportr.git\", ref = \"devel\")"},{"path":"https://atorus-research.github.io/xportr/dev/index.html","id":"what-is-xportr","dir":"","previous_headings":"","what":"What is xportr?","title":"Utilities to Output CDISC SDTM/ADaM XPT Files","text":"xportr designed clinical programmers create CDISC compliant xpt files- ADaM SDTM. Essentially, package two big components Writing xpt files well-defined metadata Checking compliance data sets. first set tools designed allow clinical programmer build CDISC compliant xpt file directly R. second set tools perform checks data sets send validators data reviewers.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/index.html","id":"what-are-the-checks","dir":"","previous_headings":"","what":"What are the checks?","title":"Utilities to Output CDISC SDTM/ADaM XPT Files","text":"Variable names must start letter (underscore), comprised uppercase letters (-Z), numerals (0-9) free non-ASCII characters, symbols, underscores. Allotted length column containing character (text) data set maximum length variable used across data sets (≤ 200) Coerces variables numeric character types Display format support numeric float date/time values Variables names ≤ 8 characters. Variable labels ≤ 40 characters. Data set labels ≤ 40 characters. Presence non-ASCII characters Variable Names, Labels data set labels. NOTE: check associated messages warning.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/index.html","id":"simple-example","dir":"","previous_headings":"","what":"Simple Example","title":"Utilities to Output CDISC SDTM/ADaM XPT Files","text":"Objective: Create fully compliant v5 xpt ADSL dataset developed using R. need following: Apply types Apply lengths Apply variable labels Apply formats Re-order variables Apply dataset label Write version 5 xpt file can done using well-defined specification file xportr package! First start ADSL dataset created R. example ADSL dataset taken {admiral} package. script generates ADSL dataset can created using command admiral::use_ad_template(\"adsl\"). ADSL dataset 306 observations 48 variables. created dummy specification file called ADaM_admiral_spec.xlsx found specs folder package. can use system.file(paste0(\"specs/\", \"ADaM_admiral_spec.xlsx\"), package = \"xportr\") access file. xportr_ function written way take part specification file apply piece dataset. Setting verbose = \"warn\" send appropriate warning message console. suppressed warning sake brevity. xportr_metadata() function can reduce duplication setting variable specification domain explicitly top pipeline. like use verbose argument, need set function call. Furthermore, ’re calling xportr functions common metadata verbosity, can shorten simply using xportr(). ’s ! now xpt file created R appropriate types, lengths, labels, ordering formats. Please check Get Started information detailed walk xportr_ function. talks Pharma companies involved {pharmaverse} enhance package play well downstream upstream packages.","code":"library(dplyr) library(admiral) library(xportr) adsl <- admiral::admiral_adsl spec_path <- system.file(paste0(\"specs/\", \"ADaM_admiral_spec.xlsx\"), package = \"xportr\") var_spec <- readxl::read_xlsx(spec_path, sheet = \"Variables\") %>% dplyr::rename(type = \"Data Type\") %>% rlang::set_names(tolower) dataset_spec <- readxl::read_xlsx(spec_path, sheet = \"Datasets\") %>% dplyr::rename(label = \"Description\") %>% rlang::set_names(tolower) adsl %>% xportr_metadata(var_spec, \"ADSL\") %>% xportr_type(verbose = \"warn\") %>% xportr_length(verbose = \"warn\") %>% xportr_label(verbose = \"warn\") %>% xportr_order(verbose = \"warn\") %>% xportr_format() %>% xportr_df_label(dataset_spec, \"ADSL\") %>% xportr_write(\"adsl.xpt\") adsl %>% xportr_metadata(var_spec, \"ADSL\", verbose = \"warn\") %>% xportr_type() %>% xportr_length() %>% xportr_label() %>% xportr_order() %>% xportr_format() %>% xportr_df_label(dataset_spec) %>% xportr_write(\"adsl.xpt\") xportr( .df = adsl, var_metadata = var_spec, df_metadata = dataset_spec, domain = \"ADSL\", verbose = \"warn\", \"adsl.xpt\" )"},{"path":"https://atorus-research.github.io/xportr/dev/index.html","id":"references","dir":"","previous_headings":"","what":"References","title":"Utilities to Output CDISC SDTM/ADaM XPT Files","text":"package developed jointly GSK Atorus.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/pull_request_template.html","id":"thank-you-for-your-pull-request","dir":"","previous_headings":"","what":"Thank you for your Pull Request!","title":"NA","text":"developed Pull Request template aid reviewers. Completing tasks helps ensure reviewers can maximize time code well making sure xportr codebase remains robust consistent.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/pull_request_template.html","id":"the-scope-of-xportr","dir":"","previous_headings":"","what":"The scope of {xportr}","title":"NA","text":"xportr’s scope enable R users write submission compliant xpt files can delivered Health Authority downstream validation software programs. see labels, lengths, types, ordering formats dataset specification object (SDTM ADaM) primary focus. also see messaging warnings users around applying information specification file primary focus. Please make sure Pull Request meets scope {xportr}. Pull Request moves beyond scope, please get touch xportr team slack create issue discuss. Please check task box acknowledgment completed task. checklist part Github Action workflows Pull Request merged main branch checked task.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/pull_request_template.html","id":"changes-description","dir":"","previous_headings":"","what":"Changes Description","title":"NA","text":"(descriptions changes)","code":""},{"path":"https://atorus-research.github.io/xportr/dev/pull_request_template.html","id":"task-list","dir":"","previous_headings":"","what":"Task List","title":"NA","text":"spirit xportr met Pull Request Place Closes # beginning Pull Request Title (Use Edit button top-right need update) Summary changes filled Changes Description. Can removed left blank changes minor/self-explanatory. Code formatted according tidyverse style guide. Use styler package functions style files accordingly. New functions arguments follow established convention found Wiki. Updated relevant unit tests written new unit tests. See Wiki conventions used package. Creation/updated relevant roxygen headers examples. See Wiki conventions used package. Run devtools::document() .Rd files man folder NAMESPACE file project root updated appropriately Run pkgdown::build_site() check affected examples displayed correctly new/updated functions occur “Reference” page. Update NEWS.md changes pertain user-facing function (.e. @export tag) documentation aimed users (rather developers) NEWS.md entry go # xportr development version section. Don’t worry updating version auto-updated using vbump.yaml CI. Address updates needed vignettes /templates. Link issue Development Panel closes successful merging. developer responsible fixing merge conflicts Reviewer. Pat back job well done! Much love accomplishment!","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/adsl.html","id":null,"dir":"Reference","previous_headings":"","what":"Analysis Dataset Subject Level — adsl","title":"Analysis Dataset Subject Level — adsl","text":"example dataset containing subject level data","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/adsl.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Analysis Dataset Subject Level — adsl","text":"","code":"adsl"},{"path":[]},{"path":"https://atorus-research.github.io/xportr/dev/reference/adsl.html","id":"adsl","dir":"Reference","previous_headings":"","what":"adsl","title":"Analysis Dataset Subject Level — adsl","text":"data frame 254 rows 48 columns: STUDYID Study Identifier USUBJID Unique Subject Identifier SUBJID Subject Identifier Study SITEID Study Site Identifier SITEGR1 Pooled Site Group 1 ARM Description Planned Arm TRT01P Planned Treatment Period 01 TRT01PN Planned Treatment Period 01 (N) TRT01A Actual Treatment Period 01 TRT01AN Actual Treatment Period 01 (N) TRTSDT Date First Exposure Treatment TRTEDT Date Last Exposure Treatment TRTDUR Duration Treatment (days) AVGDD Avg Daily Dose (planned) CUMDOSE Cumulative Dose (planned) AGE Age AGEGR1 Pooled Age Group 1 AGEGR1N Pooled Age Group 1 (N) AGEU Age Units RACE Race RACEN Race (N) SEX Sex ETHNIC Ethnicity SAFFL Safety Population Flag ITTFL Intent--Treat Population Flag EFFFL Efficacy Population Flag COMP8FL Completers Week 8 Population Flag COMP16FL Completers Week 16 Population Flag COMP24FL Completers Week 24 Population Flag DISCONFL Subject Discontinue Study DSRAEFL Discontinued due AE DTHFL Subject Died BMIBL Baseline BMI (kg/m^2) BMIBLGR1 Pooled Baseline BMI Group 1 HEIGHTBL Baseline Height (cm) WEIGHTBL Baseline Weight (kg) EDUCLVL Years Education DISONSDT Date Onset Disease DURDIS Duration Disease (Months) DURDSGR1 Pooled Disease Duration Group 1 VISIT1DT Date Visit 1 RFSTDTC Subject Reference Start Date/Time RFENDTC Subject Reference End Date/Time VISNUMEN End Trt Visit (Vis 12 Early Term.) RFENDT Date Discontinuation/Completion DCDECOD Standardized Disposition Term DCREASCD Reason Discontinuation MMSETOT MMSE Total","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/dataset_spec.html","id":null,"dir":"Reference","previous_headings":"","what":"Example Dataset Specification — dataset_spec","title":"Example Dataset Specification — dataset_spec","text":"Example Dataset Specification","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/dataset_spec.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Example Dataset Specification — dataset_spec","text":"","code":"dataset_spec"},{"path":[]},{"path":"https://atorus-research.github.io/xportr/dev/reference/dataset_spec.html","id":"dataset-spec","dir":"Reference","previous_headings":"","what":"dataset_spec","title":"Example Dataset Specification — dataset_spec","text":"data frame 1 row 9 columns: Dataset Dataset Description Dataset description Class Dataset class Structure Logical, indicating specific structure Purpose Purpose dataset Key, Variables Join Key variables dataset Repeating Indicates dataset repeating Reference Data Reference Data Comment Additional comment","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/expect_attr_width.html","id":null,"dir":"Reference","previous_headings":"","what":"Custom expect function to test result of xportr_length — expect_attr_width","title":"Custom expect function to test result of xportr_length — expect_attr_width","text":"Custom expect function test result xportr_length","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/expect_attr_width.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Custom expect function to test result of xportr_length — expect_attr_width","text":"","code":"expect_attr_width(result, metadata_length)"},{"path":"https://atorus-research.github.io/xportr/dev/reference/expect_attr_width.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Custom expect function to test result of xportr_length — expect_attr_width","text":"result data.frame width attribute columns. metadata_length vector numeric expected lengths column width.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/expect_attr_width.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Custom expect function to test result of xportr_length — expect_attr_width","text":"first argument, invisibly.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/metadata.html","id":null,"dir":"Reference","previous_headings":"","what":"Set variable specifications and domain — xportr_metadata","title":"Set variable specifications and domain — xportr_metadata","text":"Sets metadata /domain dataset way can accessed xportr functions. used start xportr pipeline, removes need set metadata domain step individually. details format metadata, see 'Metadata' section function question.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/metadata.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set variable specifications and domain — xportr_metadata","text":"","code":"xportr_metadata(.df, metadata = NULL, domain = NULL, verbose = NULL)"},{"path":"https://atorus-research.github.io/xportr/dev/reference/metadata.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set variable specifications and domain — xportr_metadata","text":".df data frame CDISC standard. metadata data frame containing variable level metadata. See 'Metadata' section details. domain Appropriate CDSIC dataset name, e.g. ADAE, DM. Used subset metadata object. none passed, name dataset passed .df used. verbose action function takes action taken dataset function validation finds issue. See 'Messaging' section details. Options 'stop', 'warn', 'message', 'none'","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/metadata.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Set variable specifications and domain — xportr_metadata","text":".df dataset metadata domain attributes set","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/metadata.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Set variable specifications and domain — xportr_metadata","text":"","code":"metadata <- data.frame( dataset = \"test\", variable = c(\"Subj\", \"Param\", \"Val\", \"NotUsed\"), type = c(\"numeric\", \"character\", \"numeric\", \"character\"), format = NA, order = c(1, 3, 4, 2) ) adlb <- data.frame( Subj = as.character(123, 456, 789), Different = c(\"a\", \"b\", \"c\"), Val = c(\"1\", \"2\", \"3\"), Param = c(\"param1\", \"param2\", \"param3\") ) xportr_metadata(adlb, metadata, \"test\") #> Subj Different Val Param #> 1 123 a 1 param1 #> 2 123 b 2 param2 #> 3 123 c 3 param3 if (rlang::is_installed(\"magrittr\")) { library(magrittr) adlb %>% xportr_metadata(metadata, \"test\") %>% xportr_type() %>% xportr_order() } #> #> ── Variable type mismatches found. ── #> #> ✔ 2 variables coerced #> #> ── 1 variables not in spec and moved to end ── #> #> ── 2 reordered in dataset ── #> #> Subj Param Val Different #> 1 123 param1 1 a #> 2 123 param2 2 b #> 3 123 param3 3 c"},{"path":"https://atorus-research.github.io/xportr/dev/reference/minimal_metadata.html","id":null,"dir":"Reference","previous_headings":"","what":"Minimal metadata data frame mock for a ADaM dataset — minimal_metadata","title":"Minimal metadata data frame mock for a ADaM dataset — minimal_metadata","text":"Minimal metadata data frame mock ADaM dataset","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/minimal_metadata.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Minimal metadata data frame mock for a ADaM dataset — minimal_metadata","text":"","code":"minimal_metadata( dataset = FALSE, length = FALSE, label = FALSE, type = FALSE, format = FALSE, order = FALSE, dataset_name = \"adsl\", var_names = NULL )"},{"path":"https://atorus-research.github.io/xportr/dev/reference/minimal_metadata.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Minimal metadata data frame mock for a ADaM dataset — minimal_metadata","text":"dataset Flag indicates dataset column included. length Flag indicates length column included. label Flag indicates label column included. type Flag indicates type column included. format Flag indicates format column included. order Flag indicates order column included. dataset_name String name domain. var_names Character vector defines variables (rows) keep","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/minimal_metadata.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Minimal metadata data frame mock for a ADaM dataset — minimal_metadata","text":"metadata data.frame","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/minimal_table.html","id":null,"dir":"Reference","previous_headings":"","what":"Minimal data frame mock of a valid ADaM dataset — minimal_table","title":"Minimal data frame mock of a valid ADaM dataset — minimal_table","text":"function used tests.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/minimal_table.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Minimal data frame mock of a valid ADaM dataset — minimal_table","text":"","code":"minimal_table(n_rows = 3, cols = c(\"x\", \"y\"))"},{"path":"https://atorus-research.github.io/xportr/dev/reference/minimal_table.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Minimal data frame mock of a valid ADaM dataset — minimal_table","text":"n_rows Numeric value indicates number rows data frame cols Vector characters indicates columns return. default x y returned numeric contents.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/minimal_table.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Minimal data frame mock of a valid ADaM dataset — minimal_table","text":"data.frame mimicking valid ADaM dataset.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/multiple_vars_in_spec_helper.html","id":null,"dir":"Reference","previous_headings":"","what":"Test if multiple vars in spec will result in warning message — multiple_vars_in_spec_helper","title":"Test if multiple vars in spec will result in warning message — multiple_vars_in_spec_helper","text":"Test multiple vars spec result warning message","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/multiple_vars_in_spec_helper.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Test if multiple vars in spec will result in warning message — multiple_vars_in_spec_helper","text":"","code":"multiple_vars_in_spec_helper(FUN)"},{"path":"https://atorus-research.github.io/xportr/dev/reference/multiple_vars_in_spec_helper2.html","id":null,"dir":"Reference","previous_headings":"","what":"Test if multiple vars in spec with appropriate — multiple_vars_in_spec_helper2","title":"Test if multiple vars in spec with appropriate — multiple_vars_in_spec_helper2","text":"Test multiple vars spec appropriate","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/multiple_vars_in_spec_helper2.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Test if multiple vars in spec with appropriate — multiple_vars_in_spec_helper2","text":"","code":"multiple_vars_in_spec_helper2(FUN)"},{"path":"https://atorus-research.github.io/xportr/dev/reference/var_spec.html","id":null,"dir":"Reference","previous_headings":"","what":"Example Dataset Variable Specification — var_spec","title":"Example Dataset Variable Specification — var_spec","text":"Example Dataset Variable Specification","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/var_spec.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Example Dataset Variable Specification — var_spec","text":"","code":"var_spec"},{"path":[]},{"path":"https://atorus-research.github.io/xportr/dev/reference/var_spec.html","id":"var-spec","dir":"Reference","previous_headings":"","what":"var_spec","title":"Example Dataset Variable Specification — var_spec","text":"data frame 216 rows 19 columns: Order Order variable Dataset Dataset Variable Variable Label Variable Label Data Type Data Type Length Variable Length Significant Digits Significant Digits Format Variable Format Mandatory Mandatory Variable Flag Assigned Value Variable Assigned Value Codelist Variable Codelist Common Common Variable Flag Origin Variable Origin Pages Pages Method Variable Method Predecessor Variable Predecessor Role Variable Role Comment Comment Developer Notes Developer Notes","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr-package.html","id":null,"dir":"Reference","previous_headings":"","what":"The xportr package — xportr-package","title":"The xportr package — xportr-package","text":"xportr designed clinical workflow friendly method outputting CDISC complaint data sets R, XPT version 5 files. designed options mind allow flexible setting options allowing projects system administrators set sensible defaults organizations workflows. list options can set customize xportr works environment.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr-package.html","id":"xportr-options","dir":"Reference","previous_headings":"","what":"xportr options","title":"The xportr package — xportr-package","text":"xportr.df_domain_name - name domain \"name\" column dataset metadata. Default: \"dataset\" xportr.df_label - column noting dataset label dataset metadata. Default: \"label\" xportr.domain_name - name domain \"name\" column variable metadata. Default: \"dataset\" xportr.variable_name - name variable \"name\" variable metadata. Default: \"variable\" xportr.type_name - name variable type column variable metadata. Default: \"type\" xportr.label - name variable label column variable metadata. Default: \"label\" xportr.length - name variable length column variable metadata. Default: \"length\" xportr.order_name - name variable order column variable metadata. Default: \"order\" xportr.format_name - name variable format column variable metadata. Default: \"format\" xportr.format_verbose - default argument 'verbose' argument xportr_format. Default: \"none\" xportr.label_verbose - default argument 'verbose' argument xportr_label. Default: \"none\" xportr.length_verbose - default argument 'verbose' argument xportr_length. Default: \"none\" xportr.type_verbose - default argument 'verbose' argument xportr_type. Default: \"none\" xportr.character_types - default character vector used explicitly coerce R classes character XPT types. Default: c(\"character\", \"char\", \"text\", \"date\", \"posixct\", \"posixt\", \"datetime\", \"time\", \"partialdate\", \"partialtime\", \"partialdatetime\", \"incompletedatetime\", \"durationdatetime\", \"intervaldatetime\") xportr.numeric_types - default character vector used explicitly coerce R classes numeric XPT types. Default: c(\"integer\", \"numeric\", \"num\", \"float\")","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr-package.html","id":"updating-options","dir":"Reference","previous_headings":"","what":"Updating Options","title":"The xportr package — xportr-package","text":"single session, option can changed option( = ) change option single projects across sessions projects, place options update .Rprofile project directory. change option user across sessions, place options update .Rprofile file users home directory. change option users R environment, place options update .Rprofile.site file R home directory.","code":""},{"path":[]},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"The xportr package — xportr-package","text":"Maintainer: Eli Miller Eli.Miller@AtorusResearch.com (ORCID) Authors: Vignesh Thanikachalam Ben Straub Ross Didenko Zelos Zhu Ethan Brockmann Vedha Viyash Andre Verissimo Sophie Shapcott Celine Piraux Adrian Chan Sadchla Mascary contributors: Atorus/GSK JPT [copyright holder]","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr.html","id":null,"dir":"Reference","previous_headings":"","what":"Wrapper to apply all core xportr functions and write xpt — xportr","title":"Wrapper to apply all core xportr functions and write xpt — xportr","text":"Wrapper apply core xportr functions write xpt","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Wrapper to apply all core xportr functions and write xpt — xportr","text":"","code":"xportr( .df, var_metadata = NULL, df_metadata = NULL, domain = NULL, verbose = NULL, path, strict_checks = FALSE )"},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Wrapper to apply all core xportr functions and write xpt — xportr","text":".df data frame CDISC standard. var_metadata data frame containing variable level metadata df_metadata data frame containing dataset level metadata. domain Appropriate CDSIC dataset name, e.g. ADAE, DM. Used subset metadata object. none passed, name dataset passed .df used. verbose action function takes action taken dataset function validation finds issue. See 'Messaging' section details. Options 'stop', 'warn', 'message', 'none' path Path transport file written. File name sans used xpt name. strict_checks TRUE, xpt validation report errors write dataset. FALSE, xpt validation report warnings continue writing dataset. Defaults FALSE","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Wrapper to apply all core xportr functions and write xpt — xportr","text":"Returns input dataframe invisibly","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Wrapper to apply all core xportr functions and write xpt — xportr","text":"","code":"library(magrittr) test_dir <- tempdir() pipeline_path <- file.path(test_dir, \"adslpipe.xpt\") xportr_path <- file.path(test_dir, \"adslxptr.xpt\") dataset_spec_low <- setNames(dataset_spec, tolower(names(dataset_spec))) names(dataset_spec_low)[[2]] <- \"label\" var_spec_low <- setNames(var_spec, tolower(names(var_spec))) names(var_spec_low)[[5]] <- \"type\" adsl %>% xportr_metadata(var_spec_low, \"ADSL\", verbose = \"none\") %>% xportr_type() %>% xportr_length() %>% xportr_label() %>% xportr_order() %>% xportr_format() %>% xportr_df_label(dataset_spec_low) %>% xportr_write(pipeline_path) #> ── Variable lengths missing from metadata. ── #> #> ✔ 2 lengths resolved #> #> ── Variable labels missing from metadata. ── #> #> ✔ 2 labels skipped #> #> ── 2 variables not in spec and moved to end ── #> #> ── 36 reordered in dataset ── #> # `xportr()` can be used to apply a whole pipeline at once xportr( adsl, var_metadata = var_spec_low, df_metadata = dataset_spec_low, domain = \"ADSL\", verbose = \"none\", path = xportr_path ) #> ── Variable lengths missing from metadata. ── #> #> ✔ 2 lengths resolved #> #> ── Variable labels missing from metadata. ── #> #> ✔ 2 labels skipped #> #> ── 2 variables not in spec and moved to end ── #> #> ── 36 reordered in dataset ── #>"},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_df_label.html","id":null,"dir":"Reference","previous_headings":"","what":"Assign Dataset Label — xportr_df_label","title":"Assign Dataset Label — xportr_df_label","text":"Assigns dataset label dataset level metadata given data frame. stored 'label' attribute dataframe.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_df_label.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Assign Dataset Label — xportr_df_label","text":"","code":"xportr_df_label(.df, metadata = NULL, domain = NULL, metacore = deprecated())"},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_df_label.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Assign Dataset Label — xportr_df_label","text":".df data frame CDISC standard. metadata data frame containing dataset. See 'Metadata' section details. domain Appropriate CDSIC dataset name, e.g. ADAE, DM. Used subset metadata object. none passed, name dataset passed .df used. metacore Previously used pass metadata now renamed metadata","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_df_label.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Assign Dataset Label — xportr_df_label","text":"Data frame label attributes.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_df_label.html","id":"metadata","dir":"Reference","previous_headings":"","what":"Metadata","title":"Assign Dataset Label — xportr_df_label","text":"argument passed 'metadata' argument can either metacore object, data.frame containing data listed . metacore used, changes options required. data.frame 'metadata' arguments two columns must present: Domain Name - passed 'xportr.df_domain_name' option. Default: \"dataset\". column subset 'domain' argument function. Label Name - passed 'xportr.df_label' option. Default: \"label\". Character values update 'label' attribute dataframe passed haven::write_xpt note label.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_df_label.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Assign Dataset Label — xportr_df_label","text":"","code":"adsl <- data.frame( USUBJID = c(1001, 1002, 1003), SITEID = c(001, 002, 003), AGE = c(63, 35, 27), SEX = c(\"M\", \"F\", \"M\") ) metadata <- data.frame( dataset = c(\"adsl\", \"adae\"), label = c(\"Subject-Level Analysis\", \"Adverse Events Analysis\") ) adsl <- xportr_df_label(adsl, metadata, domain = \"adsl\")"},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_format.html","id":null,"dir":"Reference","previous_headings":"","what":"Assign SAS Format — xportr_format","title":"Assign SAS Format — xportr_format","text":"Assigns SAS format variable level metadata given data frame. format found given variable, set empty character vector. stored 'format.sas' attribute.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_format.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Assign SAS Format — xportr_format","text":"","code":"xportr_format(.df, metadata = NULL, domain = NULL, metacore = deprecated())"},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_format.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Assign SAS Format — xportr_format","text":".df data frame CDISC standard. metadata data frame containing variable level metadata. See 'Metadata' section details. domain Appropriate CDSIC dataset name, e.g. ADAE, DM. Used subset metadata object. none passed, name dataset passed .df used. metacore Previously used pass metadata now renamed metadata","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_format.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Assign SAS Format — xportr_format","text":"Data frame SASformat attributes variable.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_format.html","id":"metadata","dir":"Reference","previous_headings":"","what":"Metadata","title":"Assign SAS Format — xportr_format","text":"argument passed 'metadata' argument can either metacore object, data.frame containing data listed . metacore used, changes options required. data.frame 'metadata' arguments three columns must present: Domain Name - passed 'xportr.domain_name' option. Default: \"dataset\". column subset 'domain' argument function. Format Name - passed 'xportr.format_name' option. Default: \"format\". Character values update 'format.sas' attribute column. passed haven::write note format. Variable Name - passed 'xportr.variable_name' option. Default: \"variable\". used match columns '.df' argument metadata.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_format.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Assign SAS Format — xportr_format","text":"","code":"adsl <- data.frame( USUBJID = c(1001, 1002, 1003), BRTHDT = c(1, 1, 2) ) metadata <- data.frame( dataset = c(\"adsl\", \"adsl\"), variable = c(\"USUBJID\", \"BRTHDT\"), format = c(NA, \"DATE9.\") ) adsl <- xportr_format(adsl, metadata, domain = \"adsl\")"},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_label.html","id":null,"dir":"Reference","previous_headings":"","what":"Assign Variable Label — xportr_label","title":"Assign Variable Label — xportr_label","text":"Assigns variable label variable level metadata given data frame. function give detect label greater 40 characters allowed XPT v5. labels present variable assigned empty character value. Labels stored 'label' attribute column.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_label.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Assign Variable Label — xportr_label","text":"","code":"xportr_label( .df, metadata = NULL, domain = NULL, verbose = NULL, metacore = deprecated() )"},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_label.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Assign Variable Label — xportr_label","text":".df data frame CDISC standard. metadata data frame containing variable level metadata. See 'Metadata' section details. domain Appropriate CDSIC dataset name, e.g. ADAE, DM. Used subset metadata object. none passed, name dataset passed .df used. verbose action function takes action taken dataset function validation finds issue. See 'Messaging' section details. Options 'stop', 'warn', 'message', 'none' metacore Previously used pass metadata now renamed metadata","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_label.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Assign Variable Label — xportr_label","text":"Data frame label attributes variable.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_label.html","id":"messaging","dir":"Reference","previous_headings":"","what":"Messaging","title":"Assign Variable Label — xportr_label","text":"label_log() primary messaging tool xportr_label(). columns present '.df' noted metadata, assigned label message generated noting number variables assigned label. variables found metadata value passed 'verbose' argument 'stop', 'warn', 'message', message generated detailing variables missing metadata.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_label.html","id":"metadata","dir":"Reference","previous_headings":"","what":"Metadata","title":"Assign Variable Label — xportr_label","text":"argument passed 'metadata' argument can either metacore object, data.frame containing data listed . metacore used, changes options required. data.frame 'metadata' arguments three columns must present: Domain Name - passed 'xportr.domain_name' option. Default: \"dataset\". column subset 'domain' argument function. Variable Name - passed 'xportr.variable_name' option. Default: \"variable\". used match columns '.df' argument metadata. Variable Label - passed 'xportr.label' option. Default: \"label\". character values update 'label' attribute column. passed haven::write note label.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_label.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Assign Variable Label — xportr_label","text":"","code":"adsl <- data.frame( USUBJID = c(1001, 1002, 1003), SITEID = c(001, 002, 003), AGE = c(63, 35, 27), SEX = c(\"M\", \"F\", \"M\") ) metadata <- data.frame( dataset = \"adsl\", variable = c(\"USUBJID\", \"SITEID\", \"AGE\", \"SEX\"), label = c(\"Unique Subject Identifier\", \"Study Site Identifier\", \"Age\", \"Sex\") ) adsl <- xportr_label(adsl, metadata, domain = \"adsl\")"},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_length.html","id":null,"dir":"Reference","previous_headings":"","what":"Assign SAS Length — xportr_length","title":"Assign SAS Length — xportr_length","text":"Assigns SAS length specified data frame, either metadata object based calculated maximum data length. length present variable length value set 200 character columns, 8 non-character columns. value stored 'width' attribute column.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_length.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Assign SAS Length — xportr_length","text":"","code":"xportr_length( .df, metadata = NULL, domain = NULL, verbose = NULL, length_source = c(\"metadata\", \"data\"), metacore = deprecated() )"},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_length.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Assign SAS Length — xportr_length","text":".df data frame CDISC standard. metadata data frame containing variable level metadata. See 'Metadata' section details. domain Appropriate CDSIC dataset name, e.g. ADAE, DM. Used subset metadata object. none passed, name dataset passed .df used. verbose action function takes action taken dataset function validation finds issue. See 'Messaging' section details. Options 'stop', 'warn', 'message', 'none' length_source Choose assigned length either metadata data. \"metadata\" specified, assigned length metadata length. \"data\" specified, assigned length determined calculated maximum data length. Permitted Values: \"metadata\", \"data\" metacore Previously used pass metadata now renamed metadata","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_length.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Assign SAS Length — xportr_length","text":"Data frame SAS default length attributes variable.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_length.html","id":"messaging","dir":"Reference","previous_headings":"","what":"Messaging","title":"Assign SAS Length — xportr_length","text":"length_log primary messaging tool xportr_length. columns present '.df' noted metadata, assigned length message generated noting number variables assigned length. variables found metadata value passed 'verbose' argument 'stop', 'warn', 'message', message generated detailing variables missing metadata.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_length.html","id":"metadata","dir":"Reference","previous_headings":"","what":"Metadata","title":"Assign SAS Length — xportr_length","text":"argument passed 'metadata' argument can either {metacore} object, data.frame containing data listed . metacore used, changes options required. data.frame 'metadata' arguments three columns must present: Domain Name - passed 'xportr.domain_name' option. Default: \"dataset\". column subset 'domain' argument function. Variable Name - passed 'xportr.variable_name' option. Default: \"variable\". used match columns '.df' argument metadata. Variable Label - passed 'xportr.length' option. Default: \"length\". numeric values update 'width' attribute column. passed haven::write note variable length.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_length.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Assign SAS Length — xportr_length","text":"","code":"adsl <- data.frame( USUBJID = c(1001, 1002, 1003), BRTHDT = c(1, 1, 2) ) metadata <- data.frame( dataset = c(\"adsl\", \"adsl\"), variable = c(\"USUBJID\", \"BRTHDT\"), length = c(10, 8) ) adsl <- xportr_length(adsl, metadata, domain = \"adsl\", length_source = \"metadata\")"},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_options.html","id":null,"dir":"Reference","previous_headings":"","what":"Get or set xportr options — xportr_options","title":"Get or set xportr options — xportr_options","text":"two mechanisms working options xportr. One options() function, part base R, xportr_options() function, xportr package. reason two mechanisms legacy code scoping. options() function sets options globally, duration R process. getOption() function retrieves value option. xportr related options type prefixed \"xportr.\".","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_options.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get or set xportr options — xportr_options","text":"","code":"xportr_options(...)"},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_options.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get or set xportr options — xportr_options","text":"... Options set, form name = value character vector option names.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_options.html","id":"options-with-options-","dir":"Reference","previous_headings":"","what":"Options with options()","title":"Get or set xportr options — xportr_options","text":"xportr.df_domain_name defaults \"dataset\" xportr.df_label defaults \"label\" xportr.domain_name defaults \"dataset\" xportr.variable_name defaults \"variable\" xportr.type_name defaults \"type\" xportr.label defaults \"label\" xportr.length defaults \"length\" xportr.order_name defaults \"order\" xportr.format_name defaults \"format\" xportr.format_verbose defaults \"none\" xportr.label_verbose defaults \"none\" xportr.length_verbose defaults \"none\" xportr.type_verbose defaults \"label\" xportr.character_types defaults c(\"character\", \"char\", \"text\", \"date\", \"posixct\", \"posixt\", \"datetime\", \"time\", \"partialdate\", \"partialtime\", \"partialdatetime\", \"incompletedatetime\", \"durationdatetime\", \"intervaldatetime\") xportr.numeric_types defaults c(\"integer\", \"numeric\", \"num\", \"float\")","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_options.html","id":"options-with-xportr-options-","dir":"Reference","previous_headings":"","what":"Options with xportr_options()","title":"Get or set xportr options — xportr_options","text":"Alternative options(), xportr_options() function can used set options. xportr_options() function also returns current options character vector options keys passed . nothing passed , returns state xportr options.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_options.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get or set xportr options — xportr_options","text":"","code":"xportr_options(\"xportr.df_label\") #> $xportr.df_label #> [1] \"label\" #> xportr_options(xportr.df_label = \"data_label\", xportr.label = \"custom_label\") xportr_options(c(\"xportr.label\", \"xportr.df_label\")) #> $xportr.label #> [1] \"custom_label\" #> #> $xportr.df_label #> [1] \"data_label\" #> xportr_options() #> $xportr.df_domain_name #> [1] \"dataset\" #> #> $xportr.df_label #> [1] \"data_label\" #> #> $xportr.domain_name #> [1] \"dataset\" #> #> $xportr.variable_name #> [1] \"variable\" #> #> $xportr.type_name #> [1] \"type\" #> #> $xportr.label #> [1] \"custom_label\" #> #> $xportr.length #> [1] \"length\" #> #> $xportr.order_name #> [1] \"order\" #> #> $xportr.format_name #> [1] \"format\" #> #> $xportr.format_verbose #> [1] \"none\" #> #> $xportr.label_verbose #> [1] \"none\" #> #> $xportr.length_verbose #> [1] \"none\" #> #> $xportr.type_verbose #> [1] \"none\" #> #> $xportr.character_types #> [1] \"character\" \"char\" \"text\" #> [4] \"date\" \"posixct\" \"posixt\" #> [7] \"datetime\" \"time\" \"partialdate\" #> [10] \"partialtime\" \"partialdatetime\" \"incompletedatetime\" #> [13] \"durationdatetime\" \"intervaldatetime\" #> #> $xportr.numeric_types #> [1] \"integer\" \"numeric\" \"num\" \"float\" #>"},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_options_list.html","id":null,"dir":"Reference","previous_headings":"","what":"A list with all the supported options of xportr — xportr_options_list","title":"A list with all the supported options of xportr — xportr_options_list","text":"internal list supported options xportr defaults","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_options_list.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"A list with all the supported options of xportr — xportr_options_list","text":"","code":"xportr_options_list"},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_options_list.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"A list with all the supported options of xportr — xportr_options_list","text":"object class list length 15.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_order.html","id":null,"dir":"Reference","previous_headings":"","what":"Order variables of a dataset according to Spec — xportr_order","title":"Order variables of a dataset according to Spec — xportr_order","text":"dplyr::arrange() function used order columns dataframe. variables missing order value appended end dataframe variables order.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_order.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Order variables of a dataset according to Spec — xportr_order","text":"","code":"xportr_order( .df, metadata = NULL, domain = NULL, verbose = NULL, metacore = deprecated() )"},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_order.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Order variables of a dataset according to Spec — xportr_order","text":".df data frame CDISC standard. metadata data frame containing variable level metadata. See 'Metadata' section details. domain Appropriate CDSIC dataset name, e.g. ADAE, DM. Used subset metadata object. none passed, name dataset passed .df used. verbose action function takes action taken dataset function validation finds issue. See 'Messaging' section details. Options 'stop', 'warn', 'message', 'none' metacore Previously used pass metadata now renamed metadata","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_order.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Order variables of a dataset according to Spec — xportr_order","text":"Dataframe re-ordered according spec","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_order.html","id":"messaging","dir":"Reference","previous_headings":"","what":"Messaging","title":"Order variables of a dataset according to Spec — xportr_order","text":"var_ord_msg() primary messaging tool xportr_order(). two primary messages output var_ord_msg(). first \"moved\" variables. variables found metadata file moved end dataset. message generated noting number, , variables moved end dataset. variables moved, 'verbose' argument 'stop', 'warn', 'message', message generated detailing variables moved. second primary message number variables dataset, correct order. message generated noting number, , variables reordered. variables reordered, 'verbose' argument 'stop', 'warn', 'message', message generated detailing variables reordered.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_order.html","id":"metadata","dir":"Reference","previous_headings":"","what":"Metadata","title":"Order variables of a dataset according to Spec — xportr_order","text":"argument passed 'metadata' argument can either metacore object, data.frame containing data listed . metacore used, changes options required. data.frame 'metadata' arguments three columns must present: Domain Name - passed 'xportr.domain_name' option. Default: \"dataset\". column subset 'domain' argument function. Variable Name - passed 'xportr.variable_name' option. Default: \"variable\". used match columns '.df' argument metadata. Variable Order - passed 'xportr.order_name' option. Default: \"order\". values used arrange order variables. values order metadata numeric, coerced prevent alphabetical sorting numeric values.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_order.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Order variables of a dataset according to Spec — xportr_order","text":"","code":"adsl <- data.frame( BRTHDT = c(1, 1, 2), STUDYID = c(\"mid987650\", \"mid987650\", \"mid987650\"), TRT01A = c(\"Active\", \"Active\", \"Placebo\"), USUBJID = c(1001, 1002, 1003) ) metadata <- data.frame( dataset = c(\"adsl\", \"adsl\", \"adsl\", \"adsl\"), variable = c(\"STUDYID\", \"USUBJID\", \"TRT01A\", \"BRTHDT\"), order = 1:4 ) adsl <- xportr_order(adsl, metadata, domain = \"adsl\") #> ── All variables in specification file are in dataset ── #> #> ── 3 reordered in dataset ── #>"},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_type.html","id":null,"dir":"Reference","previous_headings":"","what":"Coerce variable type — xportr_type","title":"Coerce variable type — xportr_type","text":"XPT v5 datasets data types character numeric. xportr_type attempts collapse R classes two XPT types. 'xportr.character_types' option used explicitly collapse class column character using .character. Similarly, 'xportr.numeric_types' collapse column numeric type. type passed variable identified timing variable, assumed numeric coerced .numeric.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_type.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Coerce variable type — xportr_type","text":"","code":"xportr_type( .df, metadata = NULL, domain = NULL, verbose = NULL, metacore = deprecated() )"},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_type.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Coerce variable type — xportr_type","text":".df data frame CDISC standard. metadata data frame containing variable level metadata. See 'Metadata' section details. domain Appropriate CDSIC dataset name, e.g. ADAE, DM. Used subset metadata object. none passed, name dataset passed .df used. verbose action function takes action taken dataset function validation finds issue. See 'Messaging' section details. Options 'stop', 'warn', 'message', 'none' metacore Previously used pass metadata now renamed metadata","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_type.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Coerce variable type — xportr_type","text":"Returns modified table.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_type.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Coerce variable type — xportr_type","text":"Certain care taken using timing variables. R serializes dates based reference date 01/01/1970 XPT uses 01/01/1960. can result dates 10 years outputting R XPT using date class. reason, xportr try determine happen variables appear used denote time. variables end DT, DTM, , TM, explicitly noted 'xportr.numeric_types' 'xportr.character_types', coerced numeric results.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_type.html","id":"messaging","dir":"Reference","previous_headings":"","what":"Messaging","title":"Coerce variable type — xportr_type","text":"type_log() primary messaging tool xportr_type(). number column types mismatch reported type metadata, , reported xportr_type(). type mismatches, 'verbose' argument 'stop', 'warn', 'message', mismatch detailed actual type data type noted metadata.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_type.html","id":"metadata","dir":"Reference","previous_headings":"","what":"Metadata","title":"Coerce variable type — xportr_type","text":"argument passed 'metadata' argument can either metacore object, data.frame containing data listed . metacore used, changes options required. data.frame 'metadata' arguments four columns must present: Domain Name - passed 'xportr.domain_name' option. Default: \"dataset\". column subset 'domain' argument function. Format Name - passed 'xportr.format_name' option. Default: \"format\". Character values update 'format.sas' attribute column. passed haven::write note format. Variable Name - passed 'xportr.variable_name' option. Default: \"variable\". used match columns '.df' argument metadata. Variable Type - passed 'xportr.type_name'. Default: \"type\". used note XPT variable \"type\" options numeric character. (Option ) Character Types - list classes explicitly coerced XPT Character type. Default: c( \"character\", \"char\", \"text\", \"date\", \"posixct\", \"posixt\", \"datetime\", \"time\", \"partialdate\", \"partialtime\", \"partialdatetime\", \"incompletedatetime\", \"durationdatetime\", \"intervaldatetime\") (Option ) Numeric Types - list classes explicitly coerced XPT numeric type. Default: c(\"integer\", \"numeric\", \"num\", \"float\")","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_type.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Coerce variable type — xportr_type","text":"","code":"metadata <- data.frame( dataset = \"test\", variable = c(\"Subj\", \"Param\", \"Val\", \"NotUsed\"), type = c(\"numeric\", \"character\", \"numeric\", \"character\"), format = NA ) .df <- data.frame( Subj = as.character(123, 456, 789), Different = c(\"a\", \"b\", \"c\"), Val = c(\"1\", \"2\", \"3\"), Param = c(\"param1\", \"param2\", \"param3\") ) df2 <- xportr_type(.df, metadata, \"test\") #> ── Variable type mismatches found. ── #> #> ✔ 2 variables coerced"},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_write.html","id":null,"dir":"Reference","previous_headings":"","what":"Write xpt v5 transport file — xportr_write","title":"Write xpt v5 transport file — xportr_write","text":"Writes local data frame SAS transport file version 5. SAS transport format open format, required submission data FDA.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_write.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Write xpt v5 transport file — xportr_write","text":"","code":"xportr_write( .df, path, metadata = NULL, domain = NULL, strict_checks = FALSE, label = deprecated() )"},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_write.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Write xpt v5 transport file — xportr_write","text":".df data frame write. path Path transport file written. File name sans used xpt name. metadata data frame containing dataset. See 'Metadata' section details. domain Appropriate CDSIC dataset name, e.g. ADAE, DM. Used subset metadata object. none passed, name dataset passed .df used. strict_checks TRUE, xpt validation report errors write dataset. FALSE, xpt validation report warnings continue writing dataset. Defaults FALSE label Previously used set Dataset label. Use metadata argument set dataset label.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_write.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Write xpt v5 transport file — xportr_write","text":"data frame. xportr_write() returns input data invisibly.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_write.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Write xpt v5 transport file — xportr_write","text":"Variable dataset labels stored \"label\" attribute. SAS format stored \"SASformat\" attribute. SAS type based metadata attribute.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_write.html","id":"metadata","dir":"Reference","previous_headings":"","what":"Metadata","title":"Write xpt v5 transport file — xportr_write","text":"argument passed 'metadata' argument can either metacore object, data.frame containing data listed . metacore used, changes options required. data.frame 'metadata' arguments two columns must present: Domain Name - passed 'xportr.df_domain_name' option. Default: \"dataset\". column subset 'domain' argument function. Label Name - passed 'xportr.df_label' option. Default: \"label\". Character values update 'label' attribute dataframe passed haven::write_xpt note label.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_write.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Write xpt v5 transport file — xportr_write","text":"","code":"adsl <- data.frame( SUBL = as.character(123, 456, 789), DIFF = c(\"a\", \"b\", \"c\"), VAL = c(\"1\", \"2\", \"3\"), PARAM = c(\"param1\", \"param2\", \"param3\") ) var_spec <- data.frame( dataset = \"adsl\", label = \"Subject-Level Analysis Dataset\", data_label = \"ADSL\" ) xportr_write(adsl, path = paste0(tempdir(), \"/adsl.xpt\"), domain = \"adsl\", metadata = var_spec, strict_checks = FALSE )"},{"path":"https://atorus-research.github.io/xportr/dev/reference/xpt_validate.html","id":null,"dir":"Reference","previous_headings":"","what":"Validate Dataset Can be Written to xpt — xpt_validate","title":"Validate Dataset Can be Written to xpt — xpt_validate","text":"Function used validate dataframes sent haven::write_xpt writing.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xpt_validate.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Validate Dataset Can be Written to xpt — xpt_validate","text":"","code":"xpt_validate(data)"},{"path":"https://atorus-research.github.io/xportr/dev/reference/xpt_validate.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Validate Dataset Can be Written to xpt — xpt_validate","text":"data Dataset exported xpt file","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xpt_validate.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Validate Dataset Can be Written to xpt — xpt_validate","text":"Returns character vector failed conditions","code":""}]
+[{"path":"https://atorus-research.github.io/xportr/dev/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2021 Atorus/GSK JPT Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/articles/deepdive.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Deep Dive into xportr","text":"vignette explore detail possibilities xportr package applying information metadata object R created dataset using core xportr functions. also explore following: goes Submission Health Authority, role xportr play Submission? xportr validating behind scenes? Breakdown xportr ADaM dataset specification file. Using options() xportr_metadata() enhance xportr experience. Understanding warning error messages xportr function. brief discussion future work. NOTE: use phrase metadata object throughout package. metadata object can either specification file read R dataframe metacore object. metadata object created via metacore package additional features covered , core using specification file. However, xportr work either dataframe metacore object.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/articles/deepdive.html","id":"what-goes-in-a-submission-to-a-health-authority","dir":"Articles","previous_headings":"","what":"What goes in a Submission to a Health Authority?","title":"Deep Dive into xportr","text":"Quite bit! focus data deliverables supporting documentation needed successful submission Health Authority xportr can play key role. briefly look three parts: Study Data Standardization Plan SDTM Data Package ADaM Data Package","code":""},{"path":"https://atorus-research.github.io/xportr/dev/articles/deepdive.html","id":"study-data-standardization-plan","dir":"Articles","previous_headings":"What goes in a Submission to a Health Authority?","what":"Study Data Standardization Plan","title":"Deep Dive into xportr","text":"Study Data Standardization Plan (SDSP) establishes documents plan describing data standardization approach clinical nonclinical studies within development program. SDSP also assists FDA identifying potential data standardization issues early development program. hope brevity section belie huge importance document. Please see Study Data Standardisation Plan (SDSP) Package maintained PHUSE working group. However, want focus actual data xportr can play role submission.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/articles/deepdive.html","id":"sdtm-and-adam-data-packages","dir":"Articles","previous_headings":"What goes in a Submission to a Health Authority?","what":"SDTM and ADaM Data Packages","title":"Deep Dive into xportr","text":"SDTM: primary pieces SDTM package SDTM annotated case report forms (acrf.pdf), data definitions document (define.xml), Study Data Reviewer’s Guide (sdrg.pdf) datasets xpt Version 5 format. Version 5 xpt file required submission format datasets going Health Authorities. ADaM: key components ADaM package similar SDTM package additions: define.xml, Analysis Study Data Reviewer’s Guide (adrg.pdf), Analysis Results Metadata (analysis-results-metadata.pdf) datasets Version 5 xpt format. Data Packages need compliant xpt files, feel xportr can play pivotal role . core functions xportr can used apply information metadata object datasets giving users feedback quality metadata data. xportr_write() can used write final dataset xpt file, can submitted Health Authority.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/articles/deepdive.html","id":"what-is-xportr-validating-in-these-data-packages","dir":"Articles","previous_headings":"What goes in a Submission to a Health Authority?","what":"What is {xportr} validating in these Data Packages?","title":"Deep Dive into xportr","text":"xpt Version 5 files form backbone successful Submission govern quite lot rules suggested guidelines. preparing data packages submission suite core xportr functions, plus xportr_write(), helps check datasets submission compliant. package checks many latest rules laid Study Data Technical Conformance Guide, please note yet exhaustive list checks. envision users also submitting xpts metadata additional validation software. core xportr functions applying labels, types, formats, order lengths provides feedback users submission compliance. However, final check implemented xportr_write() called create xpt. xportr_write() calls xpt_validate(), behind scenes/non-exported function final check compliance. time {xportr} v0.3.0 checking following user writes xpt file.:","code":""},{"path":"https://atorus-research.github.io/xportr/dev/articles/deepdive.html","id":"xportr-in-action","dir":"Articles","previous_headings":"","what":"{xportr} in action","title":"Deep Dive into xportr","text":"section, going explore 5 core xportr functions using: xportr::adsl - ADSL ADaM dataset Pilot 3 Submission FDA xportr::var_spec - ADSL ADaM Specification File Pilot 3 Submission FDA focus warning error messaging contrived examples functions manipulating either datasets specification files. NOTE: made ADSL Spec available package. Users can find additional datasets specification files repo example_data_specs folder. keep package minimum size.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/articles/deepdive.html","id":"using-options-and-xportr_metadata-to-enhance-your-experience-","dir":"Articles","previous_headings":"{xportr} in action","what":"Using options() and xportr_metadata() to enhance your experience.","title":"Deep Dive into xportr","text":"dive functions, want point quality life utilities make xpt generation life little bit easier. options() xportr_options() xportr_metadata() NOTE: long well-defined metadata object need use options() xportr_metadata(), find handy use think deserve quick mention!","code":""},{"path":"https://atorus-research.github.io/xportr/dev/articles/deepdive.html","id":"youve-got-options-or-xportr_options","dir":"Articles","previous_headings":"{xportr} in action","what":"You’ve got options() or xportr_options()","title":"Deep Dive into xportr","text":"xportr built certain assumptions around specification column names information columns. found company specification file can differ slightly assumptions. example, one company might call column Variables, another Variable another variables. Rather trying regex situation, introduced options(). options() allows users control assumptions inside xportr functions based needs. Additionally, helper function xportr_options() works just like options() , can also used get current state xportr options. Let’s take look example specification file names available package. can see columns start upper case letter spaces several . convert column names lower case deal spacing using dplyr functions base R, just use options()! using options() xportr_options() beginning script can tell xportr valid names (see chunk ). Please note set options package assumed every thing lowercase spaces names. running options() xportr_options(), xportr sees column Variable valid name rather variable. can inspect xportr_options function docs look additional options.","code":"library(rlang) library(xportr) library(dplyr) library(haven) colnames(var_spec) [1] \"Order\" \"Dataset\" \"Variable\" [4] \"Label\" \"Data Type\" \"Length\" [7] \"Significant Digits\" \"Format\" \"Mandatory\" [10] \"Assigned Value\" \"Codelist\" \"Common\" [13] \"Origin\" \"Pages\" \"Method\" [16] \"Predecessor\" \"Role\" \"Comment\" [19] \"Developer Notes\" xportr_options( xportr.variable_name = \"Variable\", xportr.label = \"Label\", xportr.type_name = \"Data Type\", xportr.format = \"Format\", xportr.length = \"Length\", xportr.order_name = \"Order\" ) # Or alternatively options( xportr.variable_name = \"Variable\", xportr.label = \"Label\", xportr.type_name = \"Data Type\", xportr.format = \"Format\", xportr.length = \"Length\", xportr.order_name = \"Order\" )"},{"path":"https://atorus-research.github.io/xportr/dev/articles/deepdive.html","id":"are-we-being-too-verbose","dir":"Articles","previous_headings":"{xportr} in action","what":"Are we being too verbose?","title":"Deep Dive into xportr","text":"One final note options. 4 core xportr functions ability set messaging \"none\", \"message\", \"warn\", \"stop\". Setting calls can bit repetitive. can use options() xportr_options() set higher level avoid repetition.","code":"# Default verbose is set to `none` xportr_options( xportr.format_verbose = \"none\", xportr.label_verbose = \"none\", xportr.length_verbose = \"none\", xportr.type_verbose = \"none\" ) xportr_options( xportr.format_verbose = \"none\", # Disables any messaging, keeping the console output clean xportr.label_verbose = \"message\", # Sends a standard message to the console xportr.length_verbose = \"warn\", # Sends a warning message to the console xportr.type_verbose = \"stop\" # Stops execution and sends an error message to the console )"},{"path":"https://atorus-research.github.io/xportr/dev/articles/deepdive.html","id":"going-meta","dir":"Articles","previous_headings":"{xportr} in action","what":"Going meta","title":"Deep Dive into xportr","text":"core xportr functions requires several inputs: valid dataframe, metadata object domain name, along optional messaging. example, simple call using functions. can see, lot information repeated call. help reduce repetitive calls, created xportr_metadata(). user can just set metadata object Domain name first call, passed functions. Much cleaner!","code":"adsl %>% xportr_type(var_spec, \"ADSL\", \"message\") %>% xportr_length(var_spec, \"ADSL\", verbose = \"message\") %>% xportr_label(var_spec, \"ADSL\", \"message\") %>% xportr_order(var_spec, \"ADSL\", \"message\") %>% xportr_format(var_spec, \"ADSL\") %>% xportr_df_label(dataset_spec, \"ADSL\") %>% xportr_write(\"adsl.xpt\") adsl %>% xportr_metadata(var_spec, \"ADSL\") %>% xportr_type() %>% xportr_length(length_source = \"metadata\") %>% xportr_label() %>% xportr_order() %>% xportr_format() %>% xportr_df_label(dataset_spec) %>% xportr_write(\"adsl.xpt\")"},{"path":"https://atorus-research.github.io/xportr/dev/articles/deepdive.html","id":"warnings-and-errors","dir":"Articles","previous_headings":"{xportr} in action","what":"Warnings and Errors","title":"Deep Dive into xportr","text":"next six sections, going explore Warnings Errors messages generated xportr core functions. better explore , either manipulate ADaM dataset specification file help showcase ability xportr functions detect issues. NOTE: made ADSL, xportr::adsl, Specification File, xportr::var_spec, available package. Users can find additional datasets specification files repo example_data_specs folder.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/articles/deepdive.html","id":"setting-up-our-metadata-object","dir":"Articles","previous_headings":"{xportr} in action > Warnings and Errors","what":"Setting up our metadata object","title":"Deep Dive into xportr","text":"First, let’s read specification file call var_spec. Note using options() . slight manipulation column names lower case, changing Data Type type making Order column numeric. can also use options() step well. var_spec object five dataset specification files stacked top . make use ADSL subset var_spec. can make use Search field dataset column subset specification file ADSL Similarly, can read Dataset spec file call dataset_spec.","code":"var_spec <- var_spec %>% rename(type = \"Data Type\") %>% set_names(tolower) dataset_spec <- dataset_spec %>% rename(label = \"Description\") %>% set_names(tolower)"},{"path":"https://atorus-research.github.io/xportr/dev/articles/deepdive.html","id":"xportr_type","dir":"Articles","previous_headings":"{xportr} in action","what":"xportr_type()","title":"Deep Dive into xportr","text":"going explore type column metadata object. submission Health Authority character numeric types data. ADSL data several columns Date type: TRTSDT, TRTEDT, DISONSDT, VISIT1DT RFENDT - hood actually numeric values left . change one variable type factor variable, common data structure R, give us educational opportunities see xportr_type() action. Success! can see , xportr_type() applied types metadata object STUDYID variables converting proper type. functions xportr also display coercion user console, seen . Note xportr_type(verbose = \"warn\") set function provided feedback, show console, variables converted warning message. However, can set verbose = \"stop\" types applied data match specification file. Using verbose = \"stop\" instantly stop processing function create object. user need alter variables R script using xportr_type()","code":"adsl_fct <- adsl %>% mutate(STUDYID = as_factor(STUDYID)) Rows: 254 Columns: 6 $ STUDYID CDISCPILOT01, CDISCPILOT01, CDISCPILOT01, CDISCPILOT01, CDISC… $ TRTSDT 2014-01-02, 2012-08-05, 2013-07-19, 2014-03-18, 2014-07-01, … $ TRTEDT 2014-07-02, 2012-09-01, 2014-01-14, 2014-03-31, 2014-12-30, … $ DISONSDT 2010-04-30, 2006-03-11, 2009-12-16, 2009-08-02, 2011-09-29, … $ VISIT1DT 2013-12-26, 2012-07-22, 2013-07-11, 2014-03-10, 2014-06-24, … $ RFENDT 2014-07-02, 2012-09-02, 2014-01-14, 2014-04-14, 2014-12-30, … adsl_type <- xportr_type(.df = adsl_fct, metadata = var_spec, domain = \"ADSL\", verbose = \"warn\") ── Variable type mismatches found. ── ✔ 1 variables coerced Warning: Variable type(s) in dataframe don't match metadata: `STUDYID` glimpse(adsl_type_glimpse) Rows: 254 Columns: 6 $ STUDYID \"CDISCPILOT01\", \"CDISCPILOT01\", \"CDISCPILOT01\", \"CDISCPILOT01… $ TRTSDT 2014-01-02, 2012-08-05, 2013-07-19, 2014-03-18, 2014-07-01, … $ TRTEDT 2014-07-02, 2012-09-01, 2014-01-14, 2014-03-31, 2014-12-30, … $ DISONSDT 2010-04-30, 2006-03-11, 2009-12-16, 2009-08-02, 2011-09-29, … $ VISIT1DT 2013-12-26, 2012-07-22, 2013-07-11, 2014-03-10, 2014-06-24, … $ RFENDT 2014-07-02, 2012-09-02, 2014-01-14, 2014-04-14, 2014-12-30, … adsl_type <- xportr_type(.df = adsl_fct, metadata = var_spec, domain = \"ADSL\", verbose = \"stop\") ── Variable type mismatches found. ── ✔ 1 variables coerced Error in `xportr_logger()`: ! Variable type(s) in dataframe don't match metadata: `STUDYID`"},{"path":"https://atorus-research.github.io/xportr/dev/articles/deepdive.html","id":"xportr_length","dir":"Articles","previous_headings":"{xportr} in action","what":"xportr_length()","title":"Deep Dive into xportr","text":"Next use xportr_length() apply length column metadata object ADSL dataset. Using str() function displayed variables attributes. can see variable label, information lengths variable. Using xportr_length() verbose = \"warn\" can apply length column columns dataset. function detects two variables, TRTDUR DCREASCD missing metadata file. Note variables slight misspellings dataset metadata, great catch! However, lengths still applied TRTDUR give length 8 DCREASCD length 200. Using str() function, can see xportr_length() successfully applied lengths variable variables dataset. Just like xportr_type(), setting verbose = \"stop\" immediately stops R processing lengths. function detects missing variables apply lengths dataset corrective action applied.","code":"tibble [254 × 48] (S3: tbl_df/tbl/data.frame) $ STUDYID : chr [1:254] \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" ... ..- attr(*, \"label\")= chr \"Study Identifier\" $ USUBJID : chr [1:254] \"01-701-1015\" \"01-701-1023\" \"01-701-1028\" \"01-701-1033\" ... ..- attr(*, \"label\")= chr \"Unique Subject Identifier\" $ SUBJID : chr [1:254] \"1015\" \"1023\" \"1028\" \"1033\" ... ..- attr(*, \"label\")= chr \"Subject Identifier for the Study\" $ SITEID : chr [1:254] \"701\" \"701\" \"701\" \"701\" ... ..- attr(*, \"label\")= chr \"Study Site Identifier\" $ SITEGR1 : chr [1:254] \"701\" \"701\" \"701\" \"701\" ... ..- attr(*, \"label\")= chr \"Pooled Site Group 1\" $ ARM : chr [1:254] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Planned Arm\" $ TRT01P : chr [1:254] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Planned Treatment for Period 01\" $ TRT01PN : num [1:254] 0 0 81 54 81 0 54 54 54 0 ... ..- attr(*, \"label\")= chr \"Planned Treatment for Period 01 (N)\" $ TRT01A : chr [1:254] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Actual Treatment for Period 01\" $ TRT01AN : num [1:254] 0 0 81 54 81 0 54 54 54 0 ... ..- attr(*, \"label\")= chr \"Actual Treatment for Period 01 (N)\" $ TRTSDT : Date[1:254], format: \"2014-01-02\" \"2012-08-05\" ... $ TRTEDT : Date[1:254], format: \"2014-07-02\" \"2012-09-01\" ... $ TRTDUR : num [1:254] 182 28 180 14 183 26 190 10 55 182 ... ..- attr(*, \"label\")= chr \"Duration of Treatment (days)\" $ AVGDD : num [1:254] 0 0 77.7 54 76.9 0 54 54 54 0 ... ..- attr(*, \"label\")= chr \"Avg Daily Dose (as planned)\" $ CUMDOSE : num [1:254] 0 0 13986 756 14067 ... ..- attr(*, \"label\")= chr \"Cumulative Dose (as planned)\" $ AGE : num [1:254] 63 64 71 74 77 85 68 81 84 52 ... ..- attr(*, \"label\")= chr \"Age\" $ AGEGR1 : chr [1:254] \"<65\" \"<65\" \"65-80\" \"65-80\" ... ..- attr(*, \"label\")= chr \"Pooled Age Group 1\" $ AGEGR1N : num [1:254] 1 1 2 2 2 3 2 3 3 1 ... ..- attr(*, \"label\")= chr \"Pooled Age Group 1 (N)\" $ AGEU : chr [1:254] \"YEARS\" \"YEARS\" \"YEARS\" \"YEARS\" ... ..- attr(*, \"label\")= chr \"Age Units\" $ RACE : chr [1:254] \"WHITE\" \"WHITE\" \"WHITE\" \"WHITE\" ... ..- attr(*, \"label\")= chr \"Race\" $ RACEN : num [1:254] 1 1 1 1 1 1 1 1 1 1 ... ..- attr(*, \"label\")= chr \"Race (N)\" $ SEX : chr [1:254] \"F\" \"M\" \"M\" \"M\" ... ..- attr(*, \"label\")= chr \"Sex\" $ ETHNIC : chr [1:254] \"HISPANIC OR LATINO\" \"HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" ... ..- attr(*, \"label\")= chr \"Ethnicity\" $ SAFFL : chr [1:254] \"Y\" \"Y\" \"Y\" \"Y\" ... ..- attr(*, \"label\")= chr \"Safety Population Flag\" $ ITTFL : chr [1:254] \"Y\" \"Y\" \"Y\" \"Y\" ... ..- attr(*, \"label\")= chr \"Intent-To-Treat Population Flag\" $ EFFFL : chr [1:254] \"Y\" \"Y\" \"Y\" \"Y\" ... ..- attr(*, \"label\")= chr \"Efficacy Population Flag\" $ COMP8FL : chr [1:254] \"Y\" \"N\" \"Y\" \"N\" ... ..- attr(*, \"label\")= chr \"Completers of Week 8 Population Flag\" $ COMP16FL: chr [1:254] \"Y\" \"N\" \"Y\" \"N\" ... ..- attr(*, \"label\")= chr \"Completers of Week 16 Population Flag\" $ COMP24FL: chr [1:254] \"Y\" \"N\" \"Y\" \"N\" ... ..- attr(*, \"label\")= chr \"Completers of Week 24 Population Flag\" $ DISCONFL: chr [1:254] \"\" \"Y\" \"\" \"Y\" ... ..- attr(*, \"label\")= chr \"Did the Subject Discontinue the Study?\" $ DSRAEFL : chr [1:254] \"\" \"Y\" \"\" \"\" ... ..- attr(*, \"label\")= chr \"Discontinued due to AE?\" $ DTHFL : chr [1:254] \"\" \"\" \"\" \"\" ... ..- attr(*, \"label\")= chr \"Subject Died?\" $ BMIBL : num [1:254] 25.1 30.4 31.4 28.8 26.1 30.4 27.3 23.9 23.9 21.9 ... ..- attr(*, \"label\")= chr \"Baseline BMI (kg/m^2)\" $ BMIBLGR1: chr [1:254] \"25-<30\" \">=30\" \">=30\" \"25-<30\" ... ..- attr(*, \"label\")= chr \"Pooled Baseline BMI Group 1\" $ HEIGHTBL: num [1:254] 147 163 178 175 155 ... ..- attr(*, \"label\")= chr \"Baseline Height (cm)\" $ WEIGHTBL: num [1:254] 54.4 80.3 99.3 88.5 62.6 67.1 78 59.9 78.9 71.2 ... ..- attr(*, \"label\")= chr \"Baseline Weight (kg)\" $ EDUCLVL : num [1:254] 16 14 16 12 9 8 18 22 12 14 ... ..- attr(*, \"label\")= chr \"Years of Education\" $ DISONSDT: Date[1:254], format: \"2010-04-30\" \"2006-03-11\" ... $ DURDIS : num [1:254] 43.9 76.4 42.8 55.3 32.9 ... ..- attr(*, \"label\")= chr \"Duration of Disease (Months)\" $ DURDSGR1: chr [1:254] \">=12\" \">=12\" \">=12\" \">=12\" ... ..- attr(*, \"label\")= chr \"Pooled Disease Duration Group 1\" $ VISIT1DT: Date[1:254], format: \"2013-12-26\" \"2012-07-22\" ... $ RFSTDTC : chr [1:254] \"2014-01-02\" \"2012-08-05\" \"2013-07-19\" \"2014-03-18\" ... ..- attr(*, \"label\")= chr \"Subject Reference Start Date/Time\" $ RFENDTC : chr [1:254] \"2014-07-02\" \"2012-09-02\" \"2014-01-14\" \"2014-04-14\" ... ..- attr(*, \"label\")= chr \"Subject Reference End Date/Time\" $ VISNUMEN: num [1:254] 12 5 12 5 12 6 12 4 8 12 ... ..- attr(*, \"label\")= chr \"End of Trt Visit (Vis 12 or Early Term.)\" $ RFENDT : Date[1:254], format: \"2014-07-02\" \"2012-09-02\" ... $ DCDECOD : chr [1:254] \"COMPLETED\" \"ADVERSE EVENT\" \"COMPLETED\" \"STUDY TERMINATED BY SPONSOR\" ... ..- attr(*, \"label\")= chr \"Standardized Disposition Term\" $ DCREASCD: chr [1:254] \"Completed\" \"Adverse Event\" \"Completed\" \"Sponsor Decision\" ... ..- attr(*, \"label\")= chr \"Reason for Discontinuation\" $ MMSETOT : num [1:254] 23 23 23 23 21 23 10 23 20 20 ... ..- attr(*, \"label\")= chr \"MMSE Total\" adsl_length <- xportr_length( .df = adsl, metadata = var_spec, domain = \"ADSL\", verbose = \"warn\", length_source = \"metadata\" ) ── Variable lengths missing from metadata. ── ✔ 2 lengths resolved Warning: Variable(s) present in dataframe but doesn't exist in `metadata`.Problem with `TRTDUR` and `DCREASCD` tibble [254 × 48] (S3: tbl_df/tbl/data.frame) $ STUDYID : chr [1:254] \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" ... ..- attr(*, \"label\")= chr \"Study Identifier\" ..- attr(*, \"width\")= chr \"12\" $ USUBJID : chr [1:254] \"01-701-1015\" \"01-701-1023\" \"01-701-1028\" \"01-701-1033\" ... ..- attr(*, \"label\")= chr \"Unique Subject Identifier\" ..- attr(*, \"width\")= chr \"11\" $ SUBJID : chr [1:254] \"1015\" \"1023\" \"1028\" \"1033\" ... ..- attr(*, \"label\")= chr \"Subject Identifier for the Study\" ..- attr(*, \"width\")= chr \"4\" $ SITEID : chr [1:254] \"701\" \"701\" \"701\" \"701\" ... ..- attr(*, \"label\")= chr \"Study Site Identifier\" ..- attr(*, \"width\")= chr \"3\" $ SITEGR1 : chr [1:254] \"701\" \"701\" \"701\" \"701\" ... ..- attr(*, \"label\")= chr \"Pooled Site Group 1\" ..- attr(*, \"width\")= chr \"3\" $ ARM : chr [1:254] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Planned Arm\" ..- attr(*, \"width\")= chr \"20\" $ TRT01P : chr [1:254] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Planned Treatment for Period 01\" ..- attr(*, \"width\")= chr \"20\" $ TRT01PN : num [1:254] 0 0 81 54 81 0 54 54 54 0 ... ..- attr(*, \"label\")= chr \"Planned Treatment for Period 01 (N)\" ..- attr(*, \"width\")= chr \"8\" $ TRT01A : chr [1:254] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Actual Treatment for Period 01\" ..- attr(*, \"width\")= chr \"20\" $ TRT01AN : num [1:254] 0 0 81 54 81 0 54 54 54 0 ... ..- attr(*, \"label\")= chr \"Actual Treatment for Period 01 (N)\" ..- attr(*, \"width\")= chr \"8\" $ TRTSDT : Date[1:254], format: \"2014-01-02\" \"2012-08-05\" ... $ TRTEDT : Date[1:254], format: \"2014-07-02\" \"2012-09-01\" ... $ TRTDUR : num [1:254] 182 28 180 14 183 26 190 10 55 182 ... ..- attr(*, \"label\")= chr \"Duration of Treatment (days)\" ..- attr(*, \"width\")= num 8 $ AVGDD : num [1:254] 0 0 77.7 54 76.9 0 54 54 54 0 ... ..- attr(*, \"label\")= chr \"Avg Daily Dose (as planned)\" ..- attr(*, \"width\")= chr \"8\" $ CUMDOSE : num [1:254] 0 0 13986 756 14067 ... ..- attr(*, \"label\")= chr \"Cumulative Dose (as planned)\" ..- attr(*, \"width\")= chr \"8\" $ AGE : num [1:254] 63 64 71 74 77 85 68 81 84 52 ... ..- attr(*, \"label\")= chr \"Age\" ..- attr(*, \"width\")= chr \"8\" $ AGEGR1 : chr [1:254] \"<65\" \"<65\" \"65-80\" \"65-80\" ... ..- attr(*, \"label\")= chr \"Pooled Age Group 1\" ..- attr(*, \"width\")= chr \"5\" $ AGEGR1N : num [1:254] 1 1 2 2 2 3 2 3 3 1 ... ..- attr(*, \"label\")= chr \"Pooled Age Group 1 (N)\" ..- attr(*, \"width\")= chr \"8\" $ AGEU : chr [1:254] \"YEARS\" \"YEARS\" \"YEARS\" \"YEARS\" ... ..- attr(*, \"label\")= chr \"Age Units\" ..- attr(*, \"width\")= chr \"5\" $ RACE : chr [1:254] \"WHITE\" \"WHITE\" \"WHITE\" \"WHITE\" ... ..- attr(*, \"label\")= chr \"Race\" ..- attr(*, \"width\")= chr \"32\" $ RACEN : num [1:254] 1 1 1 1 1 1 1 1 1 1 ... ..- attr(*, \"label\")= chr \"Race (N)\" ..- attr(*, \"width\")= chr \"8\" $ SEX : chr [1:254] \"F\" \"M\" \"M\" \"M\" ... ..- attr(*, \"label\")= chr \"Sex\" ..- attr(*, \"width\")= chr \"1\" $ ETHNIC : chr [1:254] \"HISPANIC OR LATINO\" \"HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" ... ..- attr(*, \"label\")= chr \"Ethnicity\" ..- attr(*, \"width\")= chr \"22\" $ SAFFL : chr [1:254] \"Y\" \"Y\" \"Y\" \"Y\" ... ..- attr(*, \"label\")= chr \"Safety Population Flag\" ..- attr(*, \"width\")= chr \"1\" $ ITTFL : chr [1:254] \"Y\" \"Y\" \"Y\" \"Y\" ... ..- attr(*, \"label\")= chr \"Intent-To-Treat Population Flag\" ..- attr(*, \"width\")= chr \"1\" $ EFFFL : chr [1:254] \"Y\" \"Y\" \"Y\" \"Y\" ... ..- attr(*, \"label\")= chr \"Efficacy Population Flag\" ..- attr(*, \"width\")= chr \"1\" $ COMP8FL : chr [1:254] \"Y\" \"N\" \"Y\" \"N\" ... ..- attr(*, \"label\")= chr \"Completers of Week 8 Population Flag\" ..- attr(*, \"width\")= chr \"1\" $ COMP16FL: chr [1:254] \"Y\" \"N\" \"Y\" \"N\" ... ..- attr(*, \"label\")= chr \"Completers of Week 16 Population Flag\" ..- attr(*, \"width\")= chr \"1\" $ COMP24FL: chr [1:254] \"Y\" \"N\" \"Y\" \"N\" ... ..- attr(*, \"label\")= chr \"Completers of Week 24 Population Flag\" ..- attr(*, \"width\")= chr \"1\" $ DISCONFL: chr [1:254] \"\" \"Y\" \"\" \"Y\" ... ..- attr(*, \"label\")= chr \"Did the Subject Discontinue the Study?\" ..- attr(*, \"width\")= chr \"1\" $ DSRAEFL : chr [1:254] \"\" \"Y\" \"\" \"\" ... ..- attr(*, \"label\")= chr \"Discontinued due to AE?\" ..- attr(*, \"width\")= chr \"1\" $ DTHFL : chr [1:254] \"\" \"\" \"\" \"\" ... ..- attr(*, \"label\")= chr \"Subject Died?\" ..- attr(*, \"width\")= chr \"1\" $ BMIBL : num [1:254] 25.1 30.4 31.4 28.8 26.1 30.4 27.3 23.9 23.9 21.9 ... ..- attr(*, \"label\")= chr \"Baseline BMI (kg/m^2)\" ..- attr(*, \"width\")= chr \"8\" $ BMIBLGR1: chr [1:254] \"25-<30\" \">=30\" \">=30\" \"25-<30\" ... ..- attr(*, \"label\")= chr \"Pooled Baseline BMI Group 1\" ..- attr(*, \"width\")= chr \"6\" $ HEIGHTBL: num [1:254] 147 163 178 175 155 ... ..- attr(*, \"label\")= chr \"Baseline Height (cm)\" ..- attr(*, \"width\")= chr \"8\" $ WEIGHTBL: num [1:254] 54.4 80.3 99.3 88.5 62.6 67.1 78 59.9 78.9 71.2 ... ..- attr(*, \"label\")= chr \"Baseline Weight (kg)\" ..- attr(*, \"width\")= chr \"8\" $ EDUCLVL : num [1:254] 16 14 16 12 9 8 18 22 12 14 ... ..- attr(*, \"label\")= chr \"Years of Education\" ..- attr(*, \"width\")= chr \"8\" $ DISONSDT: Date[1:254], format: \"2010-04-30\" \"2006-03-11\" ... $ DURDIS : num [1:254] 43.9 76.4 42.8 55.3 32.9 ... ..- attr(*, \"label\")= chr \"Duration of Disease (Months)\" ..- attr(*, \"width\")= chr \"8\" $ DURDSGR1: chr [1:254] \">=12\" \">=12\" \">=12\" \">=12\" ... ..- attr(*, \"label\")= chr \"Pooled Disease Duration Group 1\" ..- attr(*, \"width\")= chr \"4\" $ VISIT1DT: Date[1:254], format: \"2013-12-26\" \"2012-07-22\" ... $ RFSTDTC : chr [1:254] \"2014-01-02\" \"2012-08-05\" \"2013-07-19\" \"2014-03-18\" ... ..- attr(*, \"label\")= chr \"Subject Reference Start Date/Time\" ..- attr(*, \"width\")= chr \"20\" $ RFENDTC : chr [1:254] \"2014-07-02\" \"2012-09-02\" \"2014-01-14\" \"2014-04-14\" ... ..- attr(*, \"label\")= chr \"Subject Reference End Date/Time\" ..- attr(*, \"width\")= chr \"20\" $ VISNUMEN: num [1:254] 12 5 12 5 12 6 12 4 8 12 ... ..- attr(*, \"label\")= chr \"End of Trt Visit (Vis 12 or Early Term.)\" ..- attr(*, \"width\")= chr \"8\" $ RFENDT : Date[1:254], format: \"2014-07-02\" \"2012-09-02\" ... $ DCDECOD : chr [1:254] \"COMPLETED\" \"ADVERSE EVENT\" \"COMPLETED\" \"STUDY TERMINATED BY SPONSOR\" ... ..- attr(*, \"label\")= chr \"Standardized Disposition Term\" ..- attr(*, \"width\")= chr \"27\" $ DCREASCD: chr [1:254] \"Completed\" \"Adverse Event\" \"Completed\" \"Sponsor Decision\" ... ..- attr(*, \"label\")= chr \"Reason for Discontinuation\" ..- attr(*, \"width\")= num 200 $ MMSETOT : num [1:254] 23 23 23 23 21 23 10 23 20 20 ... ..- attr(*, \"label\")= chr \"MMSE Total\" ..- attr(*, \"width\")= chr \"8\" - attr(*, \"_xportr.df_arg_\")= chr \"ADSL\" adsl_length <- xportr_length( .df = adsl, metadata = var_spec, domain = \"ADSL\", verbose = \"stop\", length_source = \"metadata\" ) ── Variable lengths missing from metadata. ── ✔ 2 lengths resolved Error in `xportr_logger()`: ! Variable(s) present in dataframe but doesn't exist in `metadata`.Problem with `TRTDUR` and `DCREASCD`"},{"path":"https://atorus-research.github.io/xportr/dev/articles/deepdive.html","id":"xportr_label","dir":"Articles","previous_headings":"{xportr} in action","what":"xportr_label()","title":"Deep Dive into xportr","text":"creating dataset R often find R removes label variable. Using xportr_label() can easily re-apply labels variables one quick action. example, going manipulate metadata ADSL dataset: metadata variable TRTSDT label greater 40 characters. ADSL dataset labels stripped . Remember length example, labels original dataset seen str() output. successfully removed labels. Using xportr_label() apply labels metadata dataset. Please note using verbose = \"warn\" two issues TRTDUR DCREASCD reported missing metadata file. additional message sent around TRTSDT label length greater 40. Success! labels applied present metadata dataset. However, please note TRTSDT variable label characters greater 40 applied dataset TRTDUR DCREASCD empty variable labels. Just like functions, setting verbose = \"stop\" immediately stops R processing labels. function detects mismatches variables labels well label greater 40 characters. stops process, none labels applied dataset corrective action applied.","code":"var_spec_lbl <- var_spec %>% mutate(label = if_else(variable == \"TRTSDT\", \"Length of variable label must be 40 characters or less\", label )) adsl_lbl <- adsl adsl_lbl <- haven::zap_label(adsl) tibble [254 × 48] (S3: tbl_df/tbl/data.frame) $ STUDYID : chr [1:254] \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" ... $ USUBJID : chr [1:254] \"01-701-1015\" \"01-701-1023\" \"01-701-1028\" \"01-701-1033\" ... $ SUBJID : chr [1:254] \"1015\" \"1023\" \"1028\" \"1033\" ... $ SITEID : chr [1:254] \"701\" \"701\" \"701\" \"701\" ... $ SITEGR1 : chr [1:254] \"701\" \"701\" \"701\" \"701\" ... $ ARM : chr [1:254] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... $ TRT01P : chr [1:254] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... $ TRT01PN : num [1:254] 0 0 81 54 81 0 54 54 54 0 ... $ TRT01A : chr [1:254] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... $ TRT01AN : num [1:254] 0 0 81 54 81 0 54 54 54 0 ... $ TRTSDT : Date[1:254], format: \"2014-01-02\" \"2012-08-05\" ... $ TRTEDT : Date[1:254], format: \"2014-07-02\" \"2012-09-01\" ... $ TRTDUR : num [1:254] 182 28 180 14 183 26 190 10 55 182 ... $ AVGDD : num [1:254] 0 0 77.7 54 76.9 0 54 54 54 0 ... $ CUMDOSE : num [1:254] 0 0 13986 756 14067 ... $ AGE : num [1:254] 63 64 71 74 77 85 68 81 84 52 ... $ AGEGR1 : chr [1:254] \"<65\" \"<65\" \"65-80\" \"65-80\" ... $ AGEGR1N : num [1:254] 1 1 2 2 2 3 2 3 3 1 ... $ AGEU : chr [1:254] \"YEARS\" \"YEARS\" \"YEARS\" \"YEARS\" ... $ RACE : chr [1:254] \"WHITE\" \"WHITE\" \"WHITE\" \"WHITE\" ... $ RACEN : num [1:254] 1 1 1 1 1 1 1 1 1 1 ... $ SEX : chr [1:254] \"F\" \"M\" \"M\" \"M\" ... $ ETHNIC : chr [1:254] \"HISPANIC OR LATINO\" \"HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" ... $ SAFFL : chr [1:254] \"Y\" \"Y\" \"Y\" \"Y\" ... $ ITTFL : chr [1:254] \"Y\" \"Y\" \"Y\" \"Y\" ... $ EFFFL : chr [1:254] \"Y\" \"Y\" \"Y\" \"Y\" ... $ COMP8FL : chr [1:254] \"Y\" \"N\" \"Y\" \"N\" ... $ COMP16FL: chr [1:254] \"Y\" \"N\" \"Y\" \"N\" ... $ COMP24FL: chr [1:254] \"Y\" \"N\" \"Y\" \"N\" ... $ DISCONFL: chr [1:254] \"\" \"Y\" \"\" \"Y\" ... $ DSRAEFL : chr [1:254] \"\" \"Y\" \"\" \"\" ... $ DTHFL : chr [1:254] \"\" \"\" \"\" \"\" ... $ BMIBL : num [1:254] 25.1 30.4 31.4 28.8 26.1 30.4 27.3 23.9 23.9 21.9 ... $ BMIBLGR1: chr [1:254] \"25-<30\" \">=30\" \">=30\" \"25-<30\" ... $ HEIGHTBL: num [1:254] 147 163 178 175 155 ... $ WEIGHTBL: num [1:254] 54.4 80.3 99.3 88.5 62.6 67.1 78 59.9 78.9 71.2 ... $ EDUCLVL : num [1:254] 16 14 16 12 9 8 18 22 12 14 ... $ DISONSDT: Date[1:254], format: \"2010-04-30\" \"2006-03-11\" ... $ DURDIS : num [1:254] 43.9 76.4 42.8 55.3 32.9 ... $ DURDSGR1: chr [1:254] \">=12\" \">=12\" \">=12\" \">=12\" ... $ VISIT1DT: Date[1:254], format: \"2013-12-26\" \"2012-07-22\" ... $ RFSTDTC : chr [1:254] \"2014-01-02\" \"2012-08-05\" \"2013-07-19\" \"2014-03-18\" ... $ RFENDTC : chr [1:254] \"2014-07-02\" \"2012-09-02\" \"2014-01-14\" \"2014-04-14\" ... $ VISNUMEN: num [1:254] 12 5 12 5 12 6 12 4 8 12 ... $ RFENDT : Date[1:254], format: \"2014-07-02\" \"2012-09-02\" ... $ DCDECOD : chr [1:254] \"COMPLETED\" \"ADVERSE EVENT\" \"COMPLETED\" \"STUDY TERMINATED BY SPONSOR\" ... $ DCREASCD: chr [1:254] \"Completed\" \"Adverse Event\" \"Completed\" \"Sponsor Decision\" ... $ MMSETOT : num [1:254] 23 23 23 23 21 23 10 23 20 20 ... adsl_lbl <- xportr_label(.df = adsl_lbl, metadata = var_spec_lbl, domain = \"ADSL\", verbose = \"warn\") ── Variable labels missing from metadata. ── ✔ 2 labels skipped Warning: Variable(s) present in dataframe but doesn't exist in `metadata`. ✖ Problem with `TRTDUR` and `DCREASCD` Warning: Length of variable label must be 40 characters or less. ✖ Problem with `TRTSDT`. tibble [254 × 48] (S3: tbl_df/tbl/data.frame) $ STUDYID : chr [1:254] \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" ... ..- attr(*, \"label\")= chr \"Study Identifier\" $ USUBJID : chr [1:254] \"01-701-1015\" \"01-701-1023\" \"01-701-1028\" \"01-701-1033\" ... ..- attr(*, \"label\")= chr \"Unique Subject Identifier\" $ SUBJID : chr [1:254] \"1015\" \"1023\" \"1028\" \"1033\" ... ..- attr(*, \"label\")= chr \"Subject Identifier for the Study\" $ SITEID : chr [1:254] \"701\" \"701\" \"701\" \"701\" ... ..- attr(*, \"label\")= chr \"Study Site Identifier\" $ SITEGR1 : chr [1:254] \"701\" \"701\" \"701\" \"701\" ... ..- attr(*, \"label\")= chr \"Pooled Site Group 1\" $ ARM : chr [1:254] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Planned Arm\" $ TRT01P : chr [1:254] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Planned Treatment for Period 01\" $ TRT01PN : num [1:254] 0 0 81 54 81 0 54 54 54 0 ... ..- attr(*, \"label\")= chr \"Planned Treatment for Period 01 (N)\" $ TRT01A : chr [1:254] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Actual Treatment for Period 01\" $ TRT01AN : num [1:254] 0 0 81 54 81 0 54 54 54 0 ... ..- attr(*, \"label\")= chr \"Actual Treatment for Period 01 (N)\" $ TRTSDT : Date[1:254], format: \"2014-01-02\" \"2012-08-05\" ... $ TRTEDT : Date[1:254], format: \"2014-07-02\" \"2012-09-01\" ... $ TRTDUR : num [1:254] 182 28 180 14 183 26 190 10 55 182 ... ..- attr(*, \"label\")= chr \"\" $ AVGDD : num [1:254] 0 0 77.7 54 76.9 0 54 54 54 0 ... ..- attr(*, \"label\")= chr \"Avg Daily Dose (as planned)\" $ CUMDOSE : num [1:254] 0 0 13986 756 14067 ... ..- attr(*, \"label\")= chr \"Cumulative Dose (as planned)\" $ AGE : num [1:254] 63 64 71 74 77 85 68 81 84 52 ... ..- attr(*, \"label\")= chr \"Age\" $ AGEGR1 : chr [1:254] \"<65\" \"<65\" \"65-80\" \"65-80\" ... ..- attr(*, \"label\")= chr \"Pooled Age Group 1\" $ AGEGR1N : num [1:254] 1 1 2 2 2 3 2 3 3 1 ... ..- attr(*, \"label\")= chr \"Pooled Age Group 1 (N)\" $ AGEU : chr [1:254] \"YEARS\" \"YEARS\" \"YEARS\" \"YEARS\" ... ..- attr(*, \"label\")= chr \"Age Units\" $ RACE : chr [1:254] \"WHITE\" \"WHITE\" \"WHITE\" \"WHITE\" ... ..- attr(*, \"label\")= chr \"Race\" $ RACEN : num [1:254] 1 1 1 1 1 1 1 1 1 1 ... ..- attr(*, \"label\")= chr \"Race (N)\" $ SEX : chr [1:254] \"F\" \"M\" \"M\" \"M\" ... ..- attr(*, \"label\")= chr \"Sex\" $ ETHNIC : chr [1:254] \"HISPANIC OR LATINO\" \"HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" ... ..- attr(*, \"label\")= chr \"Ethnicity\" $ SAFFL : chr [1:254] \"Y\" \"Y\" \"Y\" \"Y\" ... ..- attr(*, \"label\")= chr \"Safety Population Flag\" $ ITTFL : chr [1:254] \"Y\" \"Y\" \"Y\" \"Y\" ... ..- attr(*, \"label\")= chr \"Intent-To-Treat Population Flag\" $ EFFFL : chr [1:254] \"Y\" \"Y\" \"Y\" \"Y\" ... ..- attr(*, \"label\")= chr \"Efficacy Population Flag\" $ COMP8FL : chr [1:254] \"Y\" \"N\" \"Y\" \"N\" ... ..- attr(*, \"label\")= chr \"Completers of Week 8 Population Flag\" $ COMP16FL: chr [1:254] \"Y\" \"N\" \"Y\" \"N\" ... ..- attr(*, \"label\")= chr \"Completers of Week 16 Population Flag\" $ COMP24FL: chr [1:254] \"Y\" \"N\" \"Y\" \"N\" ... ..- attr(*, \"label\")= chr \"Completers of Week 24 Population Flag\" $ DISCONFL: chr [1:254] \"\" \"Y\" \"\" \"Y\" ... ..- attr(*, \"label\")= chr \"Did the Subject Discontinue the Study?\" $ DSRAEFL : chr [1:254] \"\" \"Y\" \"\" \"\" ... ..- attr(*, \"label\")= chr \"Discontinued due to AE?\" $ DTHFL : chr [1:254] \"\" \"\" \"\" \"\" ... ..- attr(*, \"label\")= chr \"Subject Died?\" $ BMIBL : num [1:254] 25.1 30.4 31.4 28.8 26.1 30.4 27.3 23.9 23.9 21.9 ... ..- attr(*, \"label\")= chr \"Baseline BMI (kg/m^2)\" $ BMIBLGR1: chr [1:254] \"25-<30\" \">=30\" \">=30\" \"25-<30\" ... ..- attr(*, \"label\")= chr \"Pooled Baseline BMI Group 1\" $ HEIGHTBL: num [1:254] 147 163 178 175 155 ... ..- attr(*, \"label\")= chr \"Baseline Height (cm)\" $ WEIGHTBL: num [1:254] 54.4 80.3 99.3 88.5 62.6 67.1 78 59.9 78.9 71.2 ... ..- attr(*, \"label\")= chr \"Baseline Weight (kg)\" $ EDUCLVL : num [1:254] 16 14 16 12 9 8 18 22 12 14 ... ..- attr(*, \"label\")= chr \"Years of Education\" $ DISONSDT: Date[1:254], format: \"2010-04-30\" \"2006-03-11\" ... $ DURDIS : num [1:254] 43.9 76.4 42.8 55.3 32.9 ... ..- attr(*, \"label\")= chr \"Duration of Disease (Months)\" $ DURDSGR1: chr [1:254] \">=12\" \">=12\" \">=12\" \">=12\" ... ..- attr(*, \"label\")= chr \"Pooled Disease Duration Group 1\" $ VISIT1DT: Date[1:254], format: \"2013-12-26\" \"2012-07-22\" ... $ RFSTDTC : chr [1:254] \"2014-01-02\" \"2012-08-05\" \"2013-07-19\" \"2014-03-18\" ... ..- attr(*, \"label\")= chr \"Subject Reference Start Date/Time\" $ RFENDTC : chr [1:254] \"2014-07-02\" \"2012-09-02\" \"2014-01-14\" \"2014-04-14\" ... ..- attr(*, \"label\")= chr \"Subject Reference End Date/Time\" $ VISNUMEN: num [1:254] 12 5 12 5 12 6 12 4 8 12 ... ..- attr(*, \"label\")= chr \"End of Trt Visit (Vis 12 or Early Term.)\" $ RFENDT : Date[1:254], format: \"2014-07-02\" \"2012-09-02\" ... $ DCDECOD : chr [1:254] \"COMPLETED\" \"ADVERSE EVENT\" \"COMPLETED\" \"STUDY TERMINATED BY SPONSOR\" ... ..- attr(*, \"label\")= chr \"Standardized Disposition Term\" $ DCREASCD: chr [1:254] \"Completed\" \"Adverse Event\" \"Completed\" \"Sponsor Decision\" ... ..- attr(*, \"label\")= chr \"\" $ MMSETOT : num [1:254] 23 23 23 23 21 23 10 23 20 20 ... ..- attr(*, \"label\")= chr \"MMSE Total\" - attr(*, \"_xportr.df_arg_\")= chr \"ADSL\" adsl_label <- xportr_label(.df = adsl_lbl, metadata = var_spec_lbl, domain = \"ADSL\", verbose = \"stop\") ── Variable labels missing from metadata. ── ✔ 2 labels skipped Error in `xportr_logger()`: ! Variable(s) present in dataframe but doesn't exist in `metadata`. ✖ Problem with `TRTDUR` and `DCREASCD`"},{"path":"https://atorus-research.github.io/xportr/dev/articles/deepdive.html","id":"xportr_order","dir":"Articles","previous_headings":"{xportr} in action","what":"xportr_order()","title":"Deep Dive into xportr","text":"order dataset can greatly increase readability dataset downstream stakeholders. example, treatment related variables analysis variables grouped together can help inspection understanding dataset. xportr_order() can take order information metadata apply dataset. Readers encouraged inspect dataset metadata see past order updated order calling function. Note messaging xportr_order(): Variables metadata moved end Variables order re-ordered message printed ones re-ordered. Just like functions, setting verbose = \"stop\" immediately stops R processing order. variables metadata missing either, re-ordering process corrective action performed.","code":"adsl_ord <- xportr_order(.df = adsl, metadata = var_spec, domain = \"ADSL\", verbose = \"warn\") ── 2 variables not in spec and moved to end ── Warning: Variable moved to end in `.df`: `TRTDUR` and `DCREASCD` ── 36 reordered in dataset ── Warning: Variable reordered in `.df`: `AVGDD`, `CUMDOSE`, `AGE`, `AGEGR1`, `AGEGR1N`, `AGEU`, `RACE`, `RACEN`, `SEX`, `ETHNIC`, `SAFFL`, `ITTFL`, `EFFFL`, `COMP8FL`, `COMP16FL`, `COMP24FL`, `DISCONFL`, `DSRAEFL`, `DTHFL`, `BMIBL`, `BMIBLGR1`, `HEIGHTBL`, `WEIGHTBL`, `EDUCLVL`, `DISONSDT`, `DURDIS`, `DURDSGR1`, `VISIT1DT`, `RFSTDTC`, `RFENDTC`, `VISNUMEN`, `RFENDT`, `DCDECOD`, `MMSETOT`, `TRTDUR`, and `DCREASCD` adsl_ord <- xportr_order(.df = adsl, metadata = var_spec, domain = \"ADSL\", verbose = \"stop\") ── 2 variables not in spec and moved to end ── Error in `xportr_logger()`: ! Variable moved to end in `.df`: `TRTDUR` and `DCREASCD`"},{"path":"https://atorus-research.github.io/xportr/dev/articles/deepdive.html","id":"xportr_format","dir":"Articles","previous_headings":"{xportr} in action","what":"xportr_format()","title":"Deep Dive into xportr","text":"Formats play important role SAS language column specification files. able easily apply formats xpt file allow downstream users SAS quickly format data appropriately reading SAS-based system. xportr_format() can take formats apply . Please reference xportr_length() xportr_label() note missing attr() formats ADSL dataset. example slightly different previous examples. need use xportr_type() coerce R Date variables others types character numeric. can use xportr_format() apply format column dataset. Success! taken metadata formats applied dataset. Please inspect variables like TRTSDT DISONSDT see DATE9. format applied. time {xportr} v0.3.0 implemented warnings error messaging function. However, xportr_write() xpt_validate() check formats applied valid SAS formats.","code":"adsl_fmt <- adsl %>% xportr_type(metadata = var_spec, domain = \"ADSL\", verbose = \"warn\") %>% xportr_format(metadata = var_spec, domain = \"ADSL\") tibble [254 × 48] (S3: tbl_df/tbl/data.frame) $ STUDYID : chr [1:254] \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" ... ..- attr(*, \"label\")= chr \"Study Identifier\" ..- attr(*, \"format.sas\")= chr \"\" $ USUBJID : chr [1:254] \"01-701-1015\" \"01-701-1023\" \"01-701-1028\" \"01-701-1033\" ... ..- attr(*, \"label\")= chr \"Unique Subject Identifier\" ..- attr(*, \"format.sas\")= chr \"\" $ SUBJID : chr [1:254] \"1015\" \"1023\" \"1028\" \"1033\" ... ..- attr(*, \"label\")= chr \"Subject Identifier for the Study\" ..- attr(*, \"format.sas\")= chr \"\" $ SITEID : chr [1:254] \"701\" \"701\" \"701\" \"701\" ... ..- attr(*, \"label\")= chr \"Study Site Identifier\" ..- attr(*, \"format.sas\")= chr \"\" $ SITEGR1 : chr [1:254] \"701\" \"701\" \"701\" \"701\" ... ..- attr(*, \"label\")= chr \"Pooled Site Group 1\" ..- attr(*, \"format.sas\")= chr \"\" $ ARM : chr [1:254] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Planned Arm\" ..- attr(*, \"format.sas\")= chr \"\" $ TRT01P : chr [1:254] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Planned Treatment for Period 01\" ..- attr(*, \"format.sas\")= chr \"\" $ TRT01PN : num [1:254] 0 0 81 54 81 0 54 54 54 0 ... ..- attr(*, \"label\")= chr \"Planned Treatment for Period 01 (N)\" ..- attr(*, \"format.sas\")= chr \"\" $ TRT01A : chr [1:254] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Actual Treatment for Period 01\" ..- attr(*, \"format.sas\")= chr \"\" $ TRT01AN : num [1:254] 0 0 81 54 81 0 54 54 54 0 ... ..- attr(*, \"label\")= chr \"Actual Treatment for Period 01 (N)\" ..- attr(*, \"format.sas\")= chr \"\" $ TRTSDT : Date[1:254], format: \"2014-01-02\" \"2012-08-05\" ... $ TRTEDT : Date[1:254], format: \"2014-07-02\" \"2012-09-01\" ... $ TRTDUR : num [1:254] 182 28 180 14 183 26 190 10 55 182 ... ..- attr(*, \"label\")= chr \"Duration of Treatment (days)\" ..- attr(*, \"format.sas\")= chr \"\" $ AVGDD : num [1:254] 0 0 77.7 54 76.9 0 54 54 54 0 ... ..- attr(*, \"label\")= chr \"Avg Daily Dose (as planned)\" ..- attr(*, \"format.sas\")= chr \"\" $ CUMDOSE : num [1:254] 0 0 13986 756 14067 ... ..- attr(*, \"label\")= chr \"Cumulative Dose (as planned)\" ..- attr(*, \"format.sas\")= chr \"\" $ AGE : num [1:254] 63 64 71 74 77 85 68 81 84 52 ... ..- attr(*, \"label\")= chr \"Age\" ..- attr(*, \"format.sas\")= chr \"\" $ AGEGR1 : chr [1:254] \"<65\" \"<65\" \"65-80\" \"65-80\" ... ..- attr(*, \"label\")= chr \"Pooled Age Group 1\" ..- attr(*, \"format.sas\")= chr \"\" $ AGEGR1N : num [1:254] 1 1 2 2 2 3 2 3 3 1 ... ..- attr(*, \"label\")= chr \"Pooled Age Group 1 (N)\" ..- attr(*, \"format.sas\")= chr \"\" $ AGEU : chr [1:254] \"YEARS\" \"YEARS\" \"YEARS\" \"YEARS\" ... ..- attr(*, \"label\")= chr \"Age Units\" ..- attr(*, \"format.sas\")= chr \"\" $ RACE : chr [1:254] \"WHITE\" \"WHITE\" \"WHITE\" \"WHITE\" ... ..- attr(*, \"label\")= chr \"Race\" ..- attr(*, \"format.sas\")= chr \"\" $ RACEN : num [1:254] 1 1 1 1 1 1 1 1 1 1 ... ..- attr(*, \"label\")= chr \"Race (N)\" ..- attr(*, \"format.sas\")= chr \"\" $ SEX : chr [1:254] \"F\" \"M\" \"M\" \"M\" ... ..- attr(*, \"label\")= chr \"Sex\" ..- attr(*, \"format.sas\")= chr \"\" $ ETHNIC : chr [1:254] \"HISPANIC OR LATINO\" \"HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" ... ..- attr(*, \"label\")= chr \"Ethnicity\" ..- attr(*, \"format.sas\")= chr \"\" $ SAFFL : chr [1:254] \"Y\" \"Y\" \"Y\" \"Y\" ... ..- attr(*, \"label\")= chr \"Safety Population Flag\" ..- attr(*, \"format.sas\")= chr \"\" $ ITTFL : chr [1:254] \"Y\" \"Y\" \"Y\" \"Y\" ... ..- attr(*, \"label\")= chr \"Intent-To-Treat Population Flag\" ..- attr(*, \"format.sas\")= chr \"\" $ EFFFL : chr [1:254] \"Y\" \"Y\" \"Y\" \"Y\" ... ..- attr(*, \"label\")= chr \"Efficacy Population Flag\" ..- attr(*, \"format.sas\")= chr \"\" $ COMP8FL : chr [1:254] \"Y\" \"N\" \"Y\" \"N\" ... ..- attr(*, \"label\")= chr \"Completers of Week 8 Population Flag\" ..- attr(*, \"format.sas\")= chr \"\" $ COMP16FL: chr [1:254] \"Y\" \"N\" \"Y\" \"N\" ... ..- attr(*, \"label\")= chr \"Completers of Week 16 Population Flag\" ..- attr(*, \"format.sas\")= chr \"\" $ COMP24FL: chr [1:254] \"Y\" \"N\" \"Y\" \"N\" ... ..- attr(*, \"label\")= chr \"Completers of Week 24 Population Flag\" ..- attr(*, \"format.sas\")= chr \"\" $ DISCONFL: chr [1:254] \"\" \"Y\" \"\" \"Y\" ... ..- attr(*, \"label\")= chr \"Did the Subject Discontinue the Study?\" ..- attr(*, \"format.sas\")= chr \"\" $ DSRAEFL : chr [1:254] \"\" \"Y\" \"\" \"\" ... ..- attr(*, \"label\")= chr \"Discontinued due to AE?\" ..- attr(*, \"format.sas\")= chr \"\" $ DTHFL : chr [1:254] \"\" \"\" \"\" \"\" ... ..- attr(*, \"label\")= chr \"Subject Died?\" ..- attr(*, \"format.sas\")= chr \"\" $ BMIBL : num [1:254] 25.1 30.4 31.4 28.8 26.1 30.4 27.3 23.9 23.9 21.9 ... ..- attr(*, \"label\")= chr \"Baseline BMI (kg/m^2)\" ..- attr(*, \"format.sas\")= chr \"\" $ BMIBLGR1: chr [1:254] \"25-<30\" \">=30\" \">=30\" \"25-<30\" ... ..- attr(*, \"label\")= chr \"Pooled Baseline BMI Group 1\" ..- attr(*, \"format.sas\")= chr \"\" $ HEIGHTBL: num [1:254] 147 163 178 175 155 ... ..- attr(*, \"label\")= chr \"Baseline Height (cm)\" ..- attr(*, \"format.sas\")= chr \"\" $ WEIGHTBL: num [1:254] 54.4 80.3 99.3 88.5 62.6 67.1 78 59.9 78.9 71.2 ... ..- attr(*, \"label\")= chr \"Baseline Weight (kg)\" ..- attr(*, \"format.sas\")= chr \"\" $ EDUCLVL : num [1:254] 16 14 16 12 9 8 18 22 12 14 ... ..- attr(*, \"label\")= chr \"Years of Education\" ..- attr(*, \"format.sas\")= chr \"\" $ DISONSDT: Date[1:254], format: \"2010-04-30\" \"2006-03-11\" ... $ DURDIS : num [1:254] 43.9 76.4 42.8 55.3 32.9 ... ..- attr(*, \"label\")= chr \"Duration of Disease (Months)\" ..- attr(*, \"format.sas\")= chr \"\" $ DURDSGR1: chr [1:254] \">=12\" \">=12\" \">=12\" \">=12\" ... ..- attr(*, \"label\")= chr \"Pooled Disease Duration Group 1\" ..- attr(*, \"format.sas\")= chr \"\" $ VISIT1DT: Date[1:254], format: \"2013-12-26\" \"2012-07-22\" ... $ RFSTDTC : chr [1:254] \"2014-01-02\" \"2012-08-05\" \"2013-07-19\" \"2014-03-18\" ... ..- attr(*, \"label\")= chr \"Subject Reference Start Date/Time\" ..- attr(*, \"format.sas\")= chr \"\" $ RFENDTC : chr [1:254] \"2014-07-02\" \"2012-09-02\" \"2014-01-14\" \"2014-04-14\" ... ..- attr(*, \"label\")= chr \"Subject Reference End Date/Time\" ..- attr(*, \"format.sas\")= chr \"\" $ VISNUMEN: num [1:254] 12 5 12 5 12 6 12 4 8 12 ... ..- attr(*, \"label\")= chr \"End of Trt Visit (Vis 12 or Early Term.)\" ..- attr(*, \"format.sas\")= chr \"\" $ RFENDT : Date[1:254], format: \"2014-07-02\" \"2012-09-02\" ... $ DCDECOD : chr [1:254] \"COMPLETED\" \"ADVERSE EVENT\" \"COMPLETED\" \"STUDY TERMINATED BY SPONSOR\" ... ..- attr(*, \"label\")= chr \"Standardized Disposition Term\" ..- attr(*, \"format.sas\")= chr \"\" $ DCREASCD: chr [1:254] \"Completed\" \"Adverse Event\" \"Completed\" \"Sponsor Decision\" ... ..- attr(*, \"label\")= chr \"Reason for Discontinuation\" ..- attr(*, \"format.sas\")= chr \"\" $ MMSETOT : num [1:254] 23 23 23 23 21 23 10 23 20 20 ... ..- attr(*, \"label\")= chr \"MMSE Total\" ..- attr(*, \"format.sas\")= chr \"\" - attr(*, \"_xportr.df_arg_\")= chr \"ADSL\""},{"path":"https://atorus-research.github.io/xportr/dev/articles/deepdive.html","id":"xportr_write","dir":"Articles","previous_headings":"{xportr} in action","what":"xportr_write()","title":"Deep Dive into xportr","text":"Finally, want write xpt dataset metadata applied. make use xportr_metadata() reduce repetitive metadata domain specifications. use default option verbose, just message set anything verbose. xportr_write() specify path, just current working directory, set dataset label toggle strict_checks FALSE. also note worthy can set dataset label using xportr_df_label dataset_spec used xportr_write() Success! applied types, lengths, labels, ordering formats dataset. Note messages written console. Remember TRTDUR DCREASCD present metadata, dataset. impacts messaging lengths labels xportr printing feedback us two issues. 5 types coerced, well 36 variables re-ordered. Note strict_checks set FALSE. next two examples showcase strict_checks = TRUE option xportr_write() look formats labels. several ---DT type variables, xportr_write() detects lack formats applied. correct remember can use xportr_type() xportr_format() apply formats xpt dataset. manipulated labels greater 40 characters TRTSDT. turned xportr_label() verbose options produce message. However, xportr_write() strict_checks = TRUE error one many xpt_validate() checks going behind scenes.","code":"adsl %>% xportr_metadata(var_spec, \"ADSL\") %>% xportr_type() %>% xportr_length(length_source = \"metadata\") %>% xportr_label() %>% xportr_order() %>% xportr_format() %>% xportr_df_label(dataset_spec) %>% xportr_write(path = \"adsl.xpt\", strict_checks = FALSE) ── Variable lengths missing from metadata. ── ✔ 2 lengths resolved ── Variable labels missing from metadata. ── ✔ 2 labels skipped ── 2 variables not in spec and moved to end ── ── 36 reordered in dataset ── adsl %>% xportr_write(path = \"adsl.xpt\", metadata = dataset_spec, domain = \"ADSL\", strict_checks = TRUE) Error in `xportr_write()`: ! The following validation checks failed: • Formats 'TRTSDT', 'TRTEDT', 'DISONSDT', 'VISIT1DT', and 'RFENDT' must have a valid format. var_spec_lbl <- var_spec %>% mutate(label = if_else(variable == \"TRTSDT\", \"Length of variable label must be 40 characters or less\", label )) adsl %>% xportr_metadata(var_spec_lbl, \"ADSL\") %>% xportr_label() %>% xportr_type() %>% xportr_format() %>% xportr_df_label(dataset_spec) %>% xportr_write(path = \"adsl.xpt\", strict_checks = TRUE) ── Variable labels missing from metadata. ── ✔ 2 labels skipped Warning: Length of variable label must be 40 characters or less. ✖ Problem with `TRTSDT`. Error in `xportr_write()`: ! The following validation checks failed: • Label 'TRTSDT=Length of variable label must be 40 characters or less' must be 40 characters or less."},{"path":"https://atorus-research.github.io/xportr/dev/articles/deepdive.html","id":"future-work","dir":"Articles","previous_headings":"{xportr} in action","what":"Future Work","title":"Deep Dive into xportr","text":"xportr still undergoing development. hope produce vignettes functions allow users bulk process multiple datasets well examples piping xpt files related documentation validation software service. always, please let us know feature requests, documentation updates bugs GitHub repo.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/articles/xportr.html","id":"getting-started-with-xportr","dir":"Articles","previous_headings":"","what":"Getting Started with xportr","title":"Getting Started","text":"demo make use small ADSL data set apart {admiral} package. script generates ADSL dataset can created using command admiral::use_ad_template(\"adsl\"). deeper discussion xportr sure check Deep Dive User Guide. ADSL following features: 306 observations 48 variables Data types character numeric Missing labels variables Missing label data set Order variables following specification file Formats missing create fully compliant v5 xpt ADSL dataset, developed using R, need apply 6 main functions within xportr package: xportr_type() xportr_length() xportr_order() xportr_format() xportr_label() xportr_write() NOTE: ADSL dataset can created using command admiral::use_ad_template(\"adsl\").","code":"# Loading packages library(dplyr) library(labelled) library(xportr) library(admiral) library(rlang) library(readxl) # Loading in our example data adsl <- admiral::admiral_adsl"},{"path":"https://atorus-research.github.io/xportr/dev/articles/xportr.html","id":"preparing-your-specification-files","dir":"Articles","previous_headings":"","what":"Preparing your Specification Files","title":"Getting Started","text":"order make use functions within xportr need create R data frame contains specification file. likely need pre-processing spec sheets loading spec files work appropriately xportr functions. Please see example spec sheets system.file(paste0(\"specs/\", \"ADaM_admiral_spec.xlsx\"), package = \"xportr\") see xportr expects specification sheets. quick snapshot specification file pertaining ADSL data set, make use 6 xportr function calls . Take note order, label, type, length format columns.","code":"var_spec <- read_xlsx( system.file(paste0(\"specs/\", \"ADaM_admiral_spec.xlsx\"), package = \"xportr\"), sheet = \"Variables\" ) %>% rename(type = \"Data Type\") %>% set_names(tolower)"},{"path":"https://atorus-research.github.io/xportr/dev/articles/xportr.html","id":"xportr_type","dir":"Articles","previous_headings":"","what":"xportr_type()","title":"Getting Started","text":"NOTE: make use str() expose attributes (length, labels, formats, type) datasets. suppressed calls sake brevity. order compliant transport v5 specifications xpt file can two data types: character numeric/dbl. Currently ADSL data set chr, dbl, time, factor date. Using xportr_type() supplied specification file, can coerce variables ADSL set either numeric character. Now appropriate types applied dataset seen .","code":"tibble [306 × 50] (S3: tbl_df/tbl/data.frame) $ STUDYID : chr [1:306] \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" ... ..- attr(*, \"label\")= chr \"Study Identifier\" $ USUBJID : chr [1:306] \"01-701-1015\" \"01-701-1023\" \"01-701-1028\" \"01-701-1033\" ... ..- attr(*, \"label\")= chr \"Unique Subject Identifier\" $ SUBJID : chr [1:306] \"1015\" \"1023\" \"1028\" \"1033\" ... ..- attr(*, \"label\")= chr \"Subject Identifier for the Study\" $ RFSTDTC : chr [1:306] \"2014-01-02\" \"2012-08-05\" \"2013-07-19\" \"2014-03-18\" ... ..- attr(*, \"label\")= chr \"Subject Reference Start Date/Time\" $ RFENDTC : chr [1:306] \"2014-07-02\" \"2012-09-02\" \"2014-01-14\" \"2014-04-14\" ... ..- attr(*, \"label\")= chr \"Subject Reference End Date/Time\" $ RFXSTDTC: chr [1:306] \"2014-01-02\" \"2012-08-05\" \"2013-07-19\" \"2014-03-18\" ... ..- attr(*, \"label\")= chr \"Date/Time of First Study Treatment\" $ RFXENDTC: chr [1:306] \"2014-07-02\" \"2012-09-01\" \"2014-01-14\" \"2014-03-31\" ... ..- attr(*, \"label\")= chr \"Date/Time of Last Study Treatment\" $ RFICDTC : chr [1:306] NA NA NA NA ... ..- attr(*, \"label\")= chr \"Date/Time of Informed Consent\" $ RFPENDTC: chr [1:306] \"2014-07-02T11:45\" \"2013-02-18\" \"2014-01-14T11:10\" \"2014-09-15\" ... ..- attr(*, \"label\")= chr \"Date/Time of End of Participation\" $ DTHDTC : chr [1:306] NA NA NA NA ... ..- attr(*, \"label\")= chr \"Date/Time of Death\" $ DTHFL : chr [1:306] NA NA NA NA ... ..- attr(*, \"label\")= chr \"Subject Death Flag\" $ SITEID : chr [1:306] \"701\" \"701\" \"701\" \"701\" ... ..- attr(*, \"label\")= chr \"Study Site Identifier\" $ AGE : num [1:306] 63 64 71 74 77 85 59 68 81 84 ... ..- attr(*, \"label\")= chr \"Age\" $ AGEU : chr [1:306] \"YEARS\" \"YEARS\" \"YEARS\" \"YEARS\" ... ..- attr(*, \"label\")= chr \"Age Units\" $ SEX : chr [1:306] \"F\" \"M\" \"M\" \"M\" ... ..- attr(*, \"label\")= chr \"Sex\" $ RACE : chr [1:306] \"WHITE\" \"WHITE\" \"WHITE\" \"WHITE\" ... ..- attr(*, \"label\")= chr \"Race\" $ ETHNIC : chr [1:306] \"HISPANIC OR LATINO\" \"HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" ... ..- attr(*, \"label\")= chr \"Ethnicity\" $ ARMCD : chr [1:306] \"Pbo\" \"Pbo\" \"Xan_Hi\" \"Xan_Lo\" ... ..- attr(*, \"label\")= chr \"Planned Arm Code\" $ ARM : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Planned Arm\" $ ACTARMCD: chr [1:306] \"Pbo\" \"Pbo\" \"Xan_Hi\" \"Xan_Lo\" ... ..- attr(*, \"label\")= chr \"Actual Arm Code\" $ ACTARM : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Actual Arm\" $ COUNTRY : chr [1:306] \"USA\" \"USA\" \"USA\" \"USA\" ... ..- attr(*, \"label\")= chr \"Country\" $ DMDTC : chr [1:306] \"2013-12-26\" \"2012-07-22\" \"2013-07-11\" \"2014-03-10\" ... ..- attr(*, \"label\")= chr \"Date/Time of Collection\" $ DMDY : num [1:306] -7 -14 -8 -8 -7 -21 NA -9 -13 -7 ... ..- attr(*, \"label\")= chr \"Study Day of Collection\" $ TRT01P : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Planned Arm\" $ TRT01A : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Actual Arm\" $ TRTSDTM : POSIXct[1:306], format: \"2014-01-02\" ... $ TRTSTMF : chr [1:306] \"H\" \"H\" \"H\" \"H\" ... $ TRTEDTM : POSIXct[1:306], format: \"2014-07-02 23:59:59\" ... $ TRTETMF : chr [1:306] \"H\" \"H\" \"H\" \"H\" ... $ TRTSDT : Date[1:306], format: \"2014-01-02\" ... $ TRTEDT : Date[1:306], format: \"2014-07-02\" ... $ TRTDURD : num [1:306] 182 28 180 14 183 26 NA 190 10 55 ... $ SCRFDT : Date[1:306], format: NA ... $ EOSDT : Date[1:306], format: \"2014-07-02\" ... $ EOSSTT : chr [1:306] \"COMPLETED\" \"DISCONTINUED\" \"COMPLETED\" \"DISCONTINUED\" ... $ FRVDT : Date[1:306], format: NA ... $ RANDDT : Date[1:306], format: \"2014-01-02\" ... $ DTHDT : Date[1:306], format: NA ... $ DTHADY : num [1:306] NA NA NA NA NA NA NA NA NA NA ... $ LDDTHELD: num [1:306] NA NA NA NA NA NA NA NA NA NA ... $ LSTALVDT: Date[1:306], format: \"2014-07-02\" ... $ AGEGR1 : Factor w/ 3 levels \"<18\",\"18-64\",..: 2 2 3 3 3 3 2 3 3 3 ... $ SAFFL : chr [1:306] \"Y\" \"Y\" \"Y\" \"Y\" ... $ RACEGR1 : chr [1:306] \"White\" \"White\" \"White\" \"White\" ... $ REGION1 : chr [1:306] \"NA\" \"NA\" \"NA\" \"NA\" ... $ LDDTHGR1: chr [1:306] NA NA NA NA ... $ DTH30FL : chr [1:306] NA NA NA NA ... $ DTHA30FL: chr [1:306] NA NA NA NA ... $ DTHB30FL: chr [1:306] NA NA NA NA ... adsl_type <- xportr_type(adsl, var_spec, domain = \"ADSL\", verbose = \"message\") ── Variable type mismatches found. ── ✔ 1 variables coerced Variable type(s) in dataframe don't match metadata: `AGEGR1` tibble [306 × 50] (S3: tbl_df/tbl/data.frame) $ STUDYID : chr [1:306] \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" ... ..- attr(*, \"label\")= chr \"Study Identifier\" $ USUBJID : chr [1:306] \"01-701-1015\" \"01-701-1023\" \"01-701-1028\" \"01-701-1033\" ... ..- attr(*, \"label\")= chr \"Unique Subject Identifier\" $ SUBJID : chr [1:306] \"1015\" \"1023\" \"1028\" \"1033\" ... ..- attr(*, \"label\")= chr \"Subject Identifier for the Study\" $ RFSTDTC : chr [1:306] \"2014-01-02\" \"2012-08-05\" \"2013-07-19\" \"2014-03-18\" ... ..- attr(*, \"label\")= chr \"Subject Reference Start Date/Time\" $ RFENDTC : chr [1:306] \"2014-07-02\" \"2012-09-02\" \"2014-01-14\" \"2014-04-14\" ... ..- attr(*, \"label\")= chr \"Subject Reference End Date/Time\" $ RFXSTDTC: chr [1:306] \"2014-01-02\" \"2012-08-05\" \"2013-07-19\" \"2014-03-18\" ... ..- attr(*, \"label\")= chr \"Date/Time of First Study Treatment\" $ RFXENDTC: chr [1:306] \"2014-07-02\" \"2012-09-01\" \"2014-01-14\" \"2014-03-31\" ... ..- attr(*, \"label\")= chr \"Date/Time of Last Study Treatment\" $ RFICDTC : chr [1:306] NA NA NA NA ... ..- attr(*, \"label\")= chr \"Date/Time of Informed Consent\" $ RFPENDTC: chr [1:306] \"2014-07-02T11:45\" \"2013-02-18\" \"2014-01-14T11:10\" \"2014-09-15\" ... ..- attr(*, \"label\")= chr \"Date/Time of End of Participation\" $ DTHDTC : chr [1:306] NA NA NA NA ... ..- attr(*, \"label\")= chr \"Date/Time of Death\" $ DTHFL : chr [1:306] NA NA NA NA ... ..- attr(*, \"label\")= chr \"Subject Death Flag\" $ SITEID : chr [1:306] \"701\" \"701\" \"701\" \"701\" ... ..- attr(*, \"label\")= chr \"Study Site Identifier\" $ AGE : num [1:306] 63 64 71 74 77 85 59 68 81 84 ... ..- attr(*, \"label\")= chr \"Age\" $ AGEU : chr [1:306] \"YEARS\" \"YEARS\" \"YEARS\" \"YEARS\" ... ..- attr(*, \"label\")= chr \"Age Units\" $ SEX : chr [1:306] \"F\" \"M\" \"M\" \"M\" ... ..- attr(*, \"label\")= chr \"Sex\" $ RACE : chr [1:306] \"WHITE\" \"WHITE\" \"WHITE\" \"WHITE\" ... ..- attr(*, \"label\")= chr \"Race\" $ ETHNIC : chr [1:306] \"HISPANIC OR LATINO\" \"HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" ... ..- attr(*, \"label\")= chr \"Ethnicity\" $ ARMCD : chr [1:306] \"Pbo\" \"Pbo\" \"Xan_Hi\" \"Xan_Lo\" ... ..- attr(*, \"label\")= chr \"Planned Arm Code\" $ ARM : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Planned Arm\" $ ACTARMCD: chr [1:306] \"Pbo\" \"Pbo\" \"Xan_Hi\" \"Xan_Lo\" ... ..- attr(*, \"label\")= chr \"Actual Arm Code\" $ ACTARM : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Actual Arm\" $ COUNTRY : chr [1:306] \"USA\" \"USA\" \"USA\" \"USA\" ... ..- attr(*, \"label\")= chr \"Country\" $ DMDTC : chr [1:306] \"2013-12-26\" \"2012-07-22\" \"2013-07-11\" \"2014-03-10\" ... ..- attr(*, \"label\")= chr \"Date/Time of Collection\" $ DMDY : num [1:306] -7 -14 -8 -8 -7 -21 NA -9 -13 -7 ... ..- attr(*, \"label\")= chr \"Study Day of Collection\" $ TRT01P : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Planned Arm\" $ TRT01A : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Actual Arm\" $ TRTSDTM : POSIXct[1:306], format: \"2014-01-02\" ... $ TRTSTMF : chr [1:306] \"H\" \"H\" \"H\" \"H\" ... $ TRTEDTM : POSIXct[1:306], format: \"2014-07-02 23:59:59\" ... $ TRTETMF : chr [1:306] \"H\" \"H\" \"H\" \"H\" ... $ TRTSDT : Date[1:306], format: \"2014-01-02\" ... $ TRTEDT : Date[1:306], format: \"2014-07-02\" ... $ TRTDURD : num [1:306] 182 28 180 14 183 26 NA 190 10 55 ... $ SCRFDT : Date[1:306], format: NA ... $ EOSDT : Date[1:306], format: \"2014-07-02\" ... $ EOSSTT : chr [1:306] \"COMPLETED\" \"DISCONTINUED\" \"COMPLETED\" \"DISCONTINUED\" ... $ FRVDT : Date[1:306], format: NA ... $ RANDDT : Date[1:306], format: \"2014-01-02\" ... $ DTHDT : Date[1:306], format: NA ... $ DTHADY : num [1:306] NA NA NA NA NA NA NA NA NA NA ... $ LDDTHELD: num [1:306] NA NA NA NA NA NA NA NA NA NA ... $ LSTALVDT: Date[1:306], format: \"2014-07-02\" ... $ AGEGR1 : chr [1:306] \"18-64\" \"18-64\" \">=65\" \">=65\" ... $ SAFFL : chr [1:306] \"Y\" \"Y\" \"Y\" \"Y\" ... $ RACEGR1 : chr [1:306] \"White\" \"White\" \"White\" \"White\" ... $ REGION1 : chr [1:306] \"NA\" \"NA\" \"NA\" \"NA\" ... $ LDDTHGR1: chr [1:306] NA NA NA NA ... $ DTH30FL : chr [1:306] NA NA NA NA ... $ DTHA30FL: chr [1:306] NA NA NA NA ... $ DTHB30FL: chr [1:306] NA NA NA NA ... - attr(*, \"_xportr.df_arg_\")= chr \"ADSL\""},{"path":"https://atorus-research.github.io/xportr/dev/articles/xportr.html","id":"xportr_length","dir":"Articles","previous_headings":"","what":"xportr_length()","title":"Getting Started","text":"Next can apply lengths variable level specification file data frame. xportr_length() identify variables missing specification file. function also alert many lengths applied successfully. apply lengths lets verify lengths applied original dataframe. lengths applied variables seen printout - lengths attr() part variables. Let’s now use xportr_length() apply lengths specification file. Note additional attr(*, \"width\")= variable width. directly applied specification file loaded !","code":"tibble [306 × 50] (S3: tbl_df/tbl/data.frame) $ STUDYID : chr [1:306] \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" ... ..- attr(*, \"label\")= chr \"Study Identifier\" $ USUBJID : chr [1:306] \"01-701-1015\" \"01-701-1023\" \"01-701-1028\" \"01-701-1033\" ... ..- attr(*, \"label\")= chr \"Unique Subject Identifier\" $ SUBJID : chr [1:306] \"1015\" \"1023\" \"1028\" \"1033\" ... ..- attr(*, \"label\")= chr \"Subject Identifier for the Study\" $ RFSTDTC : chr [1:306] \"2014-01-02\" \"2012-08-05\" \"2013-07-19\" \"2014-03-18\" ... ..- attr(*, \"label\")= chr \"Subject Reference Start Date/Time\" $ RFENDTC : chr [1:306] \"2014-07-02\" \"2012-09-02\" \"2014-01-14\" \"2014-04-14\" ... ..- attr(*, \"label\")= chr \"Subject Reference End Date/Time\" $ RFXSTDTC: chr [1:306] \"2014-01-02\" \"2012-08-05\" \"2013-07-19\" \"2014-03-18\" ... ..- attr(*, \"label\")= chr \"Date/Time of First Study Treatment\" $ RFXENDTC: chr [1:306] \"2014-07-02\" \"2012-09-01\" \"2014-01-14\" \"2014-03-31\" ... ..- attr(*, \"label\")= chr \"Date/Time of Last Study Treatment\" $ RFICDTC : chr [1:306] NA NA NA NA ... ..- attr(*, \"label\")= chr \"Date/Time of Informed Consent\" $ RFPENDTC: chr [1:306] \"2014-07-02T11:45\" \"2013-02-18\" \"2014-01-14T11:10\" \"2014-09-15\" ... ..- attr(*, \"label\")= chr \"Date/Time of End of Participation\" $ DTHDTC : chr [1:306] NA NA NA NA ... ..- attr(*, \"label\")= chr \"Date/Time of Death\" $ DTHFL : chr [1:306] NA NA NA NA ... ..- attr(*, \"label\")= chr \"Subject Death Flag\" $ SITEID : chr [1:306] \"701\" \"701\" \"701\" \"701\" ... ..- attr(*, \"label\")= chr \"Study Site Identifier\" $ AGE : num [1:306] 63 64 71 74 77 85 59 68 81 84 ... ..- attr(*, \"label\")= chr \"Age\" $ AGEU : chr [1:306] \"YEARS\" \"YEARS\" \"YEARS\" \"YEARS\" ... ..- attr(*, \"label\")= chr \"Age Units\" $ SEX : chr [1:306] \"F\" \"M\" \"M\" \"M\" ... ..- attr(*, \"label\")= chr \"Sex\" $ RACE : chr [1:306] \"WHITE\" \"WHITE\" \"WHITE\" \"WHITE\" ... ..- attr(*, \"label\")= chr \"Race\" $ ETHNIC : chr [1:306] \"HISPANIC OR LATINO\" \"HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" ... ..- attr(*, \"label\")= chr \"Ethnicity\" $ ARMCD : chr [1:306] \"Pbo\" \"Pbo\" \"Xan_Hi\" \"Xan_Lo\" ... ..- attr(*, \"label\")= chr \"Planned Arm Code\" $ ARM : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Planned Arm\" $ ACTARMCD: chr [1:306] \"Pbo\" \"Pbo\" \"Xan_Hi\" \"Xan_Lo\" ... ..- attr(*, \"label\")= chr \"Actual Arm Code\" $ ACTARM : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Actual Arm\" $ COUNTRY : chr [1:306] \"USA\" \"USA\" \"USA\" \"USA\" ... ..- attr(*, \"label\")= chr \"Country\" $ DMDTC : chr [1:306] \"2013-12-26\" \"2012-07-22\" \"2013-07-11\" \"2014-03-10\" ... ..- attr(*, \"label\")= chr \"Date/Time of Collection\" $ DMDY : num [1:306] -7 -14 -8 -8 -7 -21 NA -9 -13 -7 ... ..- attr(*, \"label\")= chr \"Study Day of Collection\" $ TRT01P : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Planned Arm\" $ TRT01A : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Actual Arm\" $ TRTSDTM : POSIXct[1:306], format: \"2014-01-02\" ... $ TRTSTMF : chr [1:306] \"H\" \"H\" \"H\" \"H\" ... $ TRTEDTM : POSIXct[1:306], format: \"2014-07-02 23:59:59\" ... $ TRTETMF : chr [1:306] \"H\" \"H\" \"H\" \"H\" ... $ TRTSDT : Date[1:306], format: \"2014-01-02\" ... $ TRTEDT : Date[1:306], format: \"2014-07-02\" ... $ TRTDURD : num [1:306] 182 28 180 14 183 26 NA 190 10 55 ... $ SCRFDT : Date[1:306], format: NA ... $ EOSDT : Date[1:306], format: \"2014-07-02\" ... $ EOSSTT : chr [1:306] \"COMPLETED\" \"DISCONTINUED\" \"COMPLETED\" \"DISCONTINUED\" ... $ FRVDT : Date[1:306], format: NA ... $ RANDDT : Date[1:306], format: \"2014-01-02\" ... $ DTHDT : Date[1:306], format: NA ... $ DTHADY : num [1:306] NA NA NA NA NA NA NA NA NA NA ... $ LDDTHELD: num [1:306] NA NA NA NA NA NA NA NA NA NA ... $ LSTALVDT: Date[1:306], format: \"2014-07-02\" ... $ AGEGR1 : Factor w/ 3 levels \"<18\",\"18-64\",..: 2 2 3 3 3 3 2 3 3 3 ... $ SAFFL : chr [1:306] \"Y\" \"Y\" \"Y\" \"Y\" ... $ RACEGR1 : chr [1:306] \"White\" \"White\" \"White\" \"White\" ... $ REGION1 : chr [1:306] \"NA\" \"NA\" \"NA\" \"NA\" ... $ LDDTHGR1: chr [1:306] NA NA NA NA ... $ DTH30FL : chr [1:306] NA NA NA NA ... $ DTHA30FL: chr [1:306] NA NA NA NA ... $ DTHB30FL: chr [1:306] NA NA NA NA ... adsl_length <- adsl %>% xportr_length(var_spec, domain = \"ADSL\", verbose = \"message\") ── Variable lengths missing from metadata. ── ✔ 3 lengths resolved Variable(s) present in dataframe but doesn't exist in `metadata`.Problem with `TRTSTMF`, `TRTETMF`, and `RANDDT` tibble [306 × 50] (S3: tbl_df/tbl/data.frame) $ STUDYID : chr [1:306] \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" ... ..- attr(*, \"label\")= chr \"Study Identifier\" ..- attr(*, \"width\")= num 21 $ USUBJID : chr [1:306] \"01-701-1015\" \"01-701-1023\" \"01-701-1028\" \"01-701-1033\" ... ..- attr(*, \"label\")= chr \"Unique Subject Identifier\" ..- attr(*, \"width\")= num 30 $ SUBJID : chr [1:306] \"1015\" \"1023\" \"1028\" \"1033\" ... ..- attr(*, \"label\")= chr \"Subject Identifier for the Study\" ..- attr(*, \"width\")= num 8 $ RFSTDTC : chr [1:306] \"2014-01-02\" \"2012-08-05\" \"2013-07-19\" \"2014-03-18\" ... ..- attr(*, \"label\")= chr \"Subject Reference Start Date/Time\" ..- attr(*, \"width\")= num 19 $ RFENDTC : chr [1:306] \"2014-07-02\" \"2012-09-02\" \"2014-01-14\" \"2014-04-14\" ... ..- attr(*, \"label\")= chr \"Subject Reference End Date/Time\" ..- attr(*, \"width\")= num 19 $ RFXSTDTC: chr [1:306] \"2014-01-02\" \"2012-08-05\" \"2013-07-19\" \"2014-03-18\" ... ..- attr(*, \"label\")= chr \"Date/Time of First Study Treatment\" ..- attr(*, \"width\")= num 19 $ RFXENDTC: chr [1:306] \"2014-07-02\" \"2012-09-01\" \"2014-01-14\" \"2014-03-31\" ... ..- attr(*, \"label\")= chr \"Date/Time of Last Study Treatment\" ..- attr(*, \"width\")= num 19 $ RFICDTC : chr [1:306] NA NA NA NA ... ..- attr(*, \"label\")= chr \"Date/Time of Informed Consent\" ..- attr(*, \"width\")= num 19 $ RFPENDTC: chr [1:306] \"2014-07-02T11:45\" \"2013-02-18\" \"2014-01-14T11:10\" \"2014-09-15\" ... ..- attr(*, \"label\")= chr \"Date/Time of End of Participation\" ..- attr(*, \"width\")= num 19 $ DTHDTC : chr [1:306] NA NA NA NA ... ..- attr(*, \"label\")= chr \"Date/Time of Death\" ..- attr(*, \"width\")= num 19 $ DTHFL : chr [1:306] NA NA NA NA ... ..- attr(*, \"label\")= chr \"Subject Death Flag\" ..- attr(*, \"width\")= num 2 $ SITEID : chr [1:306] \"701\" \"701\" \"701\" \"701\" ... ..- attr(*, \"label\")= chr \"Study Site Identifier\" ..- attr(*, \"width\")= num 5 $ AGE : num [1:306] 63 64 71 74 77 85 59 68 81 84 ... ..- attr(*, \"label\")= chr \"Age\" ..- attr(*, \"width\")= num 8 $ AGEU : chr [1:306] \"YEARS\" \"YEARS\" \"YEARS\" \"YEARS\" ... ..- attr(*, \"label\")= chr \"Age Units\" ..- attr(*, \"width\")= num 10 $ SEX : chr [1:306] \"F\" \"M\" \"M\" \"M\" ... ..- attr(*, \"label\")= chr \"Sex\" ..- attr(*, \"width\")= num 1 $ RACE : chr [1:306] \"WHITE\" \"WHITE\" \"WHITE\" \"WHITE\" ... ..- attr(*, \"label\")= chr \"Race\" ..- attr(*, \"width\")= num 60 $ ETHNIC : chr [1:306] \"HISPANIC OR LATINO\" \"HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" ... ..- attr(*, \"label\")= chr \"Ethnicity\" ..- attr(*, \"width\")= num 100 $ ARMCD : chr [1:306] \"Pbo\" \"Pbo\" \"Xan_Hi\" \"Xan_Lo\" ... ..- attr(*, \"label\")= chr \"Planned Arm Code\" ..- attr(*, \"width\")= num 20 $ ARM : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Planned Arm\" ..- attr(*, \"width\")= num 200 $ ACTARMCD: chr [1:306] \"Pbo\" \"Pbo\" \"Xan_Hi\" \"Xan_Lo\" ... ..- attr(*, \"label\")= chr \"Actual Arm Code\" ..- attr(*, \"width\")= num 20 $ ACTARM : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Actual Arm\" ..- attr(*, \"width\")= num 200 $ COUNTRY : chr [1:306] \"USA\" \"USA\" \"USA\" \"USA\" ... ..- attr(*, \"label\")= chr \"Country\" ..- attr(*, \"width\")= num 3 $ DMDTC : chr [1:306] \"2013-12-26\" \"2012-07-22\" \"2013-07-11\" \"2014-03-10\" ... ..- attr(*, \"label\")= chr \"Date/Time of Collection\" ..- attr(*, \"width\")= num 19 $ DMDY : num [1:306] -7 -14 -8 -8 -7 -21 NA -9 -13 -7 ... ..- attr(*, \"label\")= chr \"Study Day of Collection\" ..- attr(*, \"width\")= num 8 $ TRT01P : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Planned Arm\" ..- attr(*, \"width\")= num 40 $ TRT01A : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Actual Arm\" ..- attr(*, \"width\")= num 40 $ TRTSDTM : POSIXct[1:306], format: \"2014-01-02\" ... $ TRTSTMF : chr [1:306] \"H\" \"H\" \"H\" \"H\" ... ..- attr(*, \"width\")= num 200 $ TRTEDTM : POSIXct[1:306], format: \"2014-07-02 23:59:59\" ... $ TRTETMF : chr [1:306] \"H\" \"H\" \"H\" \"H\" ... ..- attr(*, \"width\")= num 200 $ TRTSDT : Date[1:306], format: \"2014-01-02\" ... $ TRTEDT : Date[1:306], format: \"2014-07-02\" ... $ TRTDURD : num [1:306] 182 28 180 14 183 26 NA 190 10 55 ... ..- attr(*, \"width\")= num 8 $ SCRFDT : Date[1:306], format: NA ... $ EOSDT : Date[1:306], format: \"2014-07-02\" ... $ EOSSTT : chr [1:306] \"COMPLETED\" \"DISCONTINUED\" \"COMPLETED\" \"DISCONTINUED\" ... ..- attr(*, \"width\")= num 200 $ FRVDT : Date[1:306], format: NA ... $ RANDDT : Date[1:306], format: \"2014-01-02\" ... $ DTHDT : Date[1:306], format: NA ... $ DTHADY : num [1:306] NA NA NA NA NA NA NA NA NA NA ... ..- attr(*, \"width\")= num 8 $ LDDTHELD: num [1:306] NA NA NA NA NA NA NA NA NA NA ... ..- attr(*, \"width\")= num 8 $ LSTALVDT: Date[1:306], format: \"2014-07-02\" ... $ AGEGR1 : Factor w/ 3 levels \"<18\",\"18-64\",..: 2 2 3 3 3 3 2 3 3 3 ... ..- attr(*, \"width\")= num 20 $ SAFFL : chr [1:306] \"Y\" \"Y\" \"Y\" \"Y\" ... ..- attr(*, \"width\")= num 2 $ RACEGR1 : chr [1:306] \"White\" \"White\" \"White\" \"White\" ... ..- attr(*, \"width\")= num 200 $ REGION1 : chr [1:306] \"NA\" \"NA\" \"NA\" \"NA\" ... ..- attr(*, \"width\")= num 80 $ LDDTHGR1: chr [1:306] NA NA NA NA ... ..- attr(*, \"width\")= num 200 $ DTH30FL : chr [1:306] NA NA NA NA ... ..- attr(*, \"width\")= num 200 $ DTHA30FL: chr [1:306] NA NA NA NA ... ..- attr(*, \"width\")= num 200 $ DTHB30FL: chr [1:306] NA NA NA NA ... ..- attr(*, \"width\")= num 200 - attr(*, \"_xportr.df_arg_\")= chr \"ADSL\""},{"path":"https://atorus-research.github.io/xportr/dev/articles/xportr.html","id":"xportr_order","dir":"Articles","previous_headings":"","what":"xportr_order()","title":"Getting Started","text":"Please note order ADSL variables, see , match specification file order column. can quickly remedy call xportr_order(). Note variable SITEID moved well many others match specification file order column. Variables spec moved end data message written console.","code":"adsl_order <- xportr_order(adsl, var_spec, domain = \"ADSL\", verbose = \"message\") ── 3 variables not in spec and moved to end ── Variable moved to end in `.df`: `TRTSTMF`, `TRTETMF`, and `RANDDT` ── 48 reordered in dataset ── Variable reordered in `.df`: `SITEID`, `USUBJID`, `SUBJID`, `COUNTRY`, `AGE`, `AGEU`, `AGEGR1`, `SEX`, `RACE`, `RACEGR1`, `ETHNIC`, `RFSTDTC`, `RFENDTC`, `RFXSTDTC`, `RFXENDTC`, `RFICDTC`, `RFPENDTC`, `DMDTC`, `DMDY`, `SAFFL`, `ARM`, `ARMCD`, `ACTARM`, `ACTARMCD`, `TRT01P`, `TRT01A`, `TRTSDTM`, `TRTSDT`, `TRTEDT`, `DTHFL`, `DTHDTC`, `DTHDT`, `DTHADY`, `REGION1`, `TRTDURD`, `LDDTHELD`, `LSTALVDT`, `LDDTHGR1`, `DTH30FL`, `DTHA30FL`, `DTHB30FL`, `FRVDT`, `SCRFDT`, `EOSDT`, `EOSSTT`, `TRTSTMF`, `TRTETMF`, and `RANDDT`"},{"path":"https://atorus-research.github.io/xportr/dev/articles/xportr.html","id":"xportr_format","dir":"Articles","previous_headings":"","what":"xportr_format()","title":"Getting Started","text":"Now apply formats dataset. typically DATE9., DATETIME20 TIME5, many others can used. Notice ADSL dataset 8 Date/Time variables missing formats. just take peak TRT variables, NULL format. Using xportr_format() can apply formats dataset. NOTE: can use attr(data$variable, = \"format\") inspect formats applied dataframe. output individual calls bound together easier viewing.","code":"# A tibble: 4 × 2 Variable Format 1 TRTSDT 2 TRTEDT 3 TRTSDTM 4 TRTEDTM adsl_fmt <- adsl %>% xportr_format(var_spec, domain = \"ADSL\") # A tibble: 4 × 2 Variable Format 1 TRTSDT DATE9. 2 TRTEDT DATE9. 3 TRTSDTM DATETIME20. 4 TRTEDTM DATETIME20."},{"path":"https://atorus-research.github.io/xportr/dev/articles/xportr.html","id":"xportr_label","dir":"Articles","previous_headings":"","what":"xportr_label()","title":"Getting Started","text":"Please observe ADSL dataset missing many variable labels. Sometimes labels can lost using R’s function. However, CDISC compliant data set needs variable label. Using xport_label function can take specifications file label variables available. xportr_label produce warning message variable data set specification file.","code":"tibble [306 × 50] (S3: tbl_df/tbl/data.frame) $ STUDYID : chr [1:306] \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" ... $ USUBJID : chr [1:306] \"01-701-1015\" \"01-701-1023\" \"01-701-1028\" \"01-701-1033\" ... $ SUBJID : chr [1:306] \"1015\" \"1023\" \"1028\" \"1033\" ... $ RFSTDTC : chr [1:306] \"2014-01-02\" \"2012-08-05\" \"2013-07-19\" \"2014-03-18\" ... $ RFENDTC : chr [1:306] \"2014-07-02\" \"2012-09-02\" \"2014-01-14\" \"2014-04-14\" ... $ RFXSTDTC: chr [1:306] \"2014-01-02\" \"2012-08-05\" \"2013-07-19\" \"2014-03-18\" ... $ RFXENDTC: chr [1:306] \"2014-07-02\" \"2012-09-01\" \"2014-01-14\" \"2014-03-31\" ... $ RFICDTC : chr [1:306] NA NA NA NA ... $ RFPENDTC: chr [1:306] \"2014-07-02T11:45\" \"2013-02-18\" \"2014-01-14T11:10\" \"2014-09-15\" ... $ DTHDTC : chr [1:306] NA NA NA NA ... $ DTHFL : chr [1:306] NA NA NA NA ... $ SITEID : chr [1:306] \"701\" \"701\" \"701\" \"701\" ... $ AGE : num [1:306] 63 64 71 74 77 85 59 68 81 84 ... $ AGEU : chr [1:306] \"YEARS\" \"YEARS\" \"YEARS\" \"YEARS\" ... $ SEX : chr [1:306] \"F\" \"M\" \"M\" \"M\" ... $ RACE : chr [1:306] \"WHITE\" \"WHITE\" \"WHITE\" \"WHITE\" ... $ ETHNIC : chr [1:306] \"HISPANIC OR LATINO\" \"HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" ... $ ARMCD : chr [1:306] \"Pbo\" \"Pbo\" \"Xan_Hi\" \"Xan_Lo\" ... $ ARM : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... $ ACTARMCD: chr [1:306] \"Pbo\" \"Pbo\" \"Xan_Hi\" \"Xan_Lo\" ... $ ACTARM : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... $ COUNTRY : chr [1:306] \"USA\" \"USA\" \"USA\" \"USA\" ... $ DMDTC : chr [1:306] \"2013-12-26\" \"2012-07-22\" \"2013-07-11\" \"2014-03-10\" ... $ DMDY : num [1:306] -7 -14 -8 -8 -7 -21 NA -9 -13 -7 ... $ TRT01P : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... $ TRT01A : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... $ TRTSDTM : POSIXct[1:306], format: \"2014-01-02\" ... $ TRTSTMF : chr [1:306] \"H\" \"H\" \"H\" \"H\" ... $ TRTEDTM : POSIXct[1:306], format: \"2014-07-02 23:59:59\" ... $ TRTETMF : chr [1:306] \"H\" \"H\" \"H\" \"H\" ... $ TRTSDT : Date[1:306], format: \"2014-01-02\" ... $ TRTEDT : Date[1:306], format: \"2014-07-02\" ... $ TRTDURD : num [1:306] 182 28 180 14 183 26 NA 190 10 55 ... $ SCRFDT : Date[1:306], format: NA ... $ EOSDT : Date[1:306], format: \"2014-07-02\" ... $ EOSSTT : chr [1:306] \"COMPLETED\" \"DISCONTINUED\" \"COMPLETED\" \"DISCONTINUED\" ... $ FRVDT : Date[1:306], format: NA ... $ RANDDT : Date[1:306], format: \"2014-01-02\" ... $ DTHDT : Date[1:306], format: NA ... $ DTHADY : num [1:306] NA NA NA NA NA NA NA NA NA NA ... $ LDDTHELD: num [1:306] NA NA NA NA NA NA NA NA NA NA ... $ LSTALVDT: Date[1:306], format: \"2014-07-02\" ... $ AGEGR1 : Factor w/ 3 levels \"<18\",\"18-64\",..: 2 2 3 3 3 3 2 3 3 3 ... $ SAFFL : chr [1:306] \"Y\" \"Y\" \"Y\" \"Y\" ... $ RACEGR1 : chr [1:306] \"White\" \"White\" \"White\" \"White\" ... $ REGION1 : chr [1:306] \"NA\" \"NA\" \"NA\" \"NA\" ... $ LDDTHGR1: chr [1:306] NA NA NA NA ... $ DTH30FL : chr [1:306] NA NA NA NA ... $ DTHA30FL: chr [1:306] NA NA NA NA ... $ DTHB30FL: chr [1:306] NA NA NA NA ... adsl_lbl <- adsl %>% xportr_label(var_spec, domain = \"ADSL\", \"message\") ── Variable labels missing from metadata. ── ✔ 3 labels skipped Variable(s) present in dataframe but doesn't exist in `metadata`. ✖ Problem with `TRTSTMF`, `TRTETMF`, and `RANDDT` str(adsl_lbl) tibble [306 × 50] (S3: tbl_df/tbl/data.frame) $ STUDYID : chr [1:306] \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" \"CDISCPILOT01\" ... ..- attr(*, \"label\")= chr \"Study Identifier\" $ USUBJID : chr [1:306] \"01-701-1015\" \"01-701-1023\" \"01-701-1028\" \"01-701-1033\" ... ..- attr(*, \"label\")= chr \"Unique Subject Identifier\" $ SUBJID : chr [1:306] \"1015\" \"1023\" \"1028\" \"1033\" ... ..- attr(*, \"label\")= chr \"Subject Identifier for the Study\" $ RFSTDTC : chr [1:306] \"2014-01-02\" \"2012-08-05\" \"2013-07-19\" \"2014-03-18\" ... ..- attr(*, \"label\")= chr \"Subject Reference Start Date/Time\" $ RFENDTC : chr [1:306] \"2014-07-02\" \"2012-09-02\" \"2014-01-14\" \"2014-04-14\" ... ..- attr(*, \"label\")= chr \"Subject Reference End Date/Time\" $ RFXSTDTC: chr [1:306] \"2014-01-02\" \"2012-08-05\" \"2013-07-19\" \"2014-03-18\" ... ..- attr(*, \"label\")= chr \"Date/Time of First Study Treatment\" $ RFXENDTC: chr [1:306] \"2014-07-02\" \"2012-09-01\" \"2014-01-14\" \"2014-03-31\" ... ..- attr(*, \"label\")= chr \"Date/Time of Last Study Treatment\" $ RFICDTC : chr [1:306] NA NA NA NA ... ..- attr(*, \"label\")= chr \"Date/Time of Informed Consent\" $ RFPENDTC: chr [1:306] \"2014-07-02T11:45\" \"2013-02-18\" \"2014-01-14T11:10\" \"2014-09-15\" ... ..- attr(*, \"label\")= chr \"Date/Time of End of Participation\" $ DTHDTC : chr [1:306] NA NA NA NA ... ..- attr(*, \"label\")= chr \"Date / Time of Death\" $ DTHFL : chr [1:306] NA NA NA NA ... ..- attr(*, \"label\")= chr \"Subject Death Flag\" $ SITEID : chr [1:306] \"701\" \"701\" \"701\" \"701\" ... ..- attr(*, \"label\")= chr \"Study Site Identifier\" $ AGE : num [1:306] 63 64 71 74 77 85 59 68 81 84 ... ..- attr(*, \"label\")= chr \"Age\" $ AGEU : chr [1:306] \"YEARS\" \"YEARS\" \"YEARS\" \"YEARS\" ... ..- attr(*, \"label\")= chr \"Age Units\" $ SEX : chr [1:306] \"F\" \"M\" \"M\" \"M\" ... ..- attr(*, \"label\")= chr \"Sex\" $ RACE : chr [1:306] \"WHITE\" \"WHITE\" \"WHITE\" \"WHITE\" ... ..- attr(*, \"label\")= chr \"Race\" $ ETHNIC : chr [1:306] \"HISPANIC OR LATINO\" \"HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" \"NOT HISPANIC OR LATINO\" ... ..- attr(*, \"label\")= chr \"Ethnicity\" $ ARMCD : chr [1:306] \"Pbo\" \"Pbo\" \"Xan_Hi\" \"Xan_Lo\" ... ..- attr(*, \"label\")= chr \"Planned Arm Code\" $ ARM : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Planned Arm\" $ ACTARMCD: chr [1:306] \"Pbo\" \"Pbo\" \"Xan_Hi\" \"Xan_Lo\" ... ..- attr(*, \"label\")= chr \"Actual Arm Code\" $ ACTARM : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Description of Actual Arm\" $ COUNTRY : chr [1:306] \"USA\" \"USA\" \"USA\" \"USA\" ... ..- attr(*, \"label\")= chr \"Country\" $ DMDTC : chr [1:306] \"2013-12-26\" \"2012-07-22\" \"2013-07-11\" \"2014-03-10\" ... ..- attr(*, \"label\")= chr \"Date/Time of Collection\" $ DMDY : num [1:306] -7 -14 -8 -8 -7 -21 NA -9 -13 -7 ... ..- attr(*, \"label\")= chr \"Study Day of Collection\" $ TRT01P : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Planned Treatment for Period 01\" $ TRT01A : chr [1:306] \"Placebo\" \"Placebo\" \"Xanomeline High Dose\" \"Xanomeline Low Dose\" ... ..- attr(*, \"label\")= chr \"Actual Treatment for Period 01\" $ TRTSDTM : POSIXct[1:306], format: \"2014-01-02\" ... $ TRTSTMF : chr [1:306] \"H\" \"H\" \"H\" \"H\" ... ..- attr(*, \"label\")= chr \"\" $ TRTEDTM : POSIXct[1:306], format: \"2014-07-02 23:59:59\" ... $ TRTETMF : chr [1:306] \"H\" \"H\" \"H\" \"H\" ... ..- attr(*, \"label\")= chr \"\" $ TRTSDT : Date[1:306], format: \"2014-01-02\" ... $ TRTEDT : Date[1:306], format: \"2014-07-02\" ... $ TRTDURD : num [1:306] 182 28 180 14 183 26 NA 190 10 55 ... ..- attr(*, \"label\")= chr \"Total Duration of Trt (days)\" $ SCRFDT : Date[1:306], format: NA ... $ EOSDT : Date[1:306], format: \"2014-07-02\" ... $ EOSSTT : chr [1:306] \"COMPLETED\" \"DISCONTINUED\" \"COMPLETED\" \"DISCONTINUED\" ... ..- attr(*, \"label\")= chr \"End of Study Status\" $ FRVDT : Date[1:306], format: NA ... $ RANDDT : Date[1:306], format: \"2014-01-02\" ... $ DTHDT : Date[1:306], format: NA ... $ DTHADY : num [1:306] NA NA NA NA NA NA NA NA NA NA ... ..- attr(*, \"label\")= chr \"Relative Day of Death\" $ LDDTHELD: num [1:306] NA NA NA NA NA NA NA NA NA NA ... ..- attr(*, \"label\")= chr \"Elapsed Days from Last Dose to Death\" $ LSTALVDT: Date[1:306], format: \"2014-07-02\" ... $ AGEGR1 : Factor w/ 3 levels \"<18\",\"18-64\",..: 2 2 3 3 3 3 2 3 3 3 ... ..- attr(*, \"label\")= chr \"Pooled Age Group 1\" $ SAFFL : chr [1:306] \"Y\" \"Y\" \"Y\" \"Y\" ... ..- attr(*, \"label\")= chr \"Safety Population Flag\" $ RACEGR1 : chr [1:306] \"White\" \"White\" \"White\" \"White\" ... ..- attr(*, \"label\")= chr \"Pooled Race Group 1\" $ REGION1 : chr [1:306] \"NA\" \"NA\" \"NA\" \"NA\" ... ..- attr(*, \"label\")= chr \"Geographic Region 1\" $ LDDTHGR1: chr [1:306] NA NA NA NA ... ..- attr(*, \"label\")= chr \"Last Does to Death Group\" $ DTH30FL : chr [1:306] NA NA NA NA ... ..- attr(*, \"label\")= chr \"Under 30 Group\" $ DTHA30FL: chr [1:306] NA NA NA NA ... ..- attr(*, \"label\")= chr \"Over 30 Group\" $ DTHB30FL: chr [1:306] NA NA NA NA ... ..- attr(*, \"label\")= chr \"Over 30 plus 30 days Group\" - attr(*, \"_xportr.df_arg_\")= chr \"ADSL\""},{"path":"https://atorus-research.github.io/xportr/dev/articles/xportr.html","id":"xportr_write","dir":"Articles","previous_headings":"","what":"xportr_write()","title":"Getting Started","text":"Finally, arrive exporting R data frame object xpt file xportr_write(). xpt file written directly current working directory. make interesting, put together six functions magrittr pipe, %>%. user can now apply types, length, variable labels, formats, data set label write final xpt file one pipe! Appropriate warnings messages supplied user console potential issues sending standard clinical data set validator application data reviewers. ’s ! now xpt file created R appropriate types, lengths, labels, ordering formats specification file. interested exploring custom warnings error messages well background xpt generation sure check Deep Dive User Guide. always, welcome feedback. spot bug, like see new feature, documentation unclear - submit issue xportr’s GitHub page.","code":"adsl %>% xportr_type(var_spec, \"ADSL\", \"message\") %>% xportr_length(var_spec, \"ADSL\", verbose = \"message\") %>% xportr_label(var_spec, \"ADSL\", \"message\") %>% xportr_order(var_spec, \"ADSL\", \"message\") %>% xportr_format(var_spec, \"ADSL\") %>% xportr_write(\"adsl.xpt\") ── Variable type mismatches found. ── ✔ 1 variables coerced Variable type(s) in dataframe don't match metadata: `AGEGR1` ── Variable lengths missing from metadata. ── ✔ 3 lengths resolved Variable(s) present in dataframe but doesn't exist in `metadata`.Problem with `TRTSTMF`, `TRTETMF`, and `RANDDT` ── Variable labels missing from metadata. ── ✔ 3 labels skipped Variable(s) present in dataframe but doesn't exist in `metadata`. ✖ Problem with `TRTSTMF`, `TRTETMF`, and `RANDDT` ── 3 variables not in spec and moved to end ── Variable moved to end in `.df`: `TRTSTMF`, `TRTETMF`, and `RANDDT` ── 48 reordered in dataset ── Variable reordered in `.df`: `SITEID`, `USUBJID`, `SUBJID`, `COUNTRY`, `AGE`, `AGEU`, `AGEGR1`, `SEX`, `RACE`, `RACEGR1`, `ETHNIC`, `RFSTDTC`, `RFENDTC`, `RFXSTDTC`, `RFXENDTC`, `RFICDTC`, `RFPENDTC`, `DMDTC`, `DMDY`, `SAFFL`, `ARM`, `ARMCD`, `ACTARM`, `ACTARMCD`, `TRT01P`, `TRT01A`, `TRTSDTM`, `TRTSDT`, `TRTEDT`, `DTHFL`, `DTHDTC`, `DTHDT`, `DTHADY`, `REGION1`, `TRTDURD`, `LDDTHELD`, `LSTALVDT`, `LDDTHGR1`, `DTH30FL`, `DTHA30FL`, `DTHB30FL`, `FRVDT`, `SCRFDT`, `EOSDT`, `EOSSTT`, `TRTSTMF`, `TRTETMF`, and `RANDDT`"},{"path":"https://atorus-research.github.io/xportr/dev/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Eli Miller. Author, maintainer. Vignesh Thanikachalam. Author. Ben Straub. Author. Ross Didenko. Author. Zelos Zhu. Author. Ethan Brockmann. Author. Vedha Viyash. Author. Andre Verissimo. Author. Sophie Shapcott. Author. Celine Piraux. Author. Adrian Chan. Author. Sadchla Mascary. Author. Atorus/GSK JPT. Copyright holder.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Miller E, Thanikachalam V, Straub B, Didenko R, Zhu Z, Brockmann E, Viyash V, Verissimo , Shapcott S, Piraux C, Chan , Mascary S (2024). xportr: Utilities Output CDISC SDTM/ADaM XPT Files. R package version 0.3.1.9016, https://github.com/atorus-research/xportr.","code":"@Manual{, title = {xportr: Utilities to Output CDISC SDTM/ADaM XPT Files}, author = {Eli Miller and Vignesh Thanikachalam and Ben Straub and Ross Didenko and Zelos Zhu and Ethan Brockmann and Vedha Viyash and Andre Verissimo and Sophie Shapcott and Celine Piraux and Adrian Chan and Sadchla Mascary}, year = {2024}, note = {R package version 0.3.1.9016}, url = {https://github.com/atorus-research/xportr}, }"},{"path":"https://atorus-research.github.io/xportr/dev/index.html","id":"xportr-","dir":"","previous_headings":"","what":"Utilities to Output CDISC SDTM/ADaM XPT Files","title":"Utilities to Output CDISC SDTM/ADaM XPT Files","text":"Welcome xportr! designed xportr help get xpt files ready transport either clinical data set validator application regulatory agency. package functionality associate metadata information local R data frame, perform data set level validation checks convert transport v5 file(xpt). always, welcome feedback. spot bug, like see new feature, documentation unclear - submit issue xportr’s GitHub page.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Utilities to Output CDISC SDTM/ADaM XPT Files","text":"package available CRAN can installed running:","code":"install.packages(\"xportr\")"},{"path":"https://atorus-research.github.io/xportr/dev/index.html","id":"development-version","dir":"","previous_headings":"Installation","what":"Development version:","title":"Utilities to Output CDISC SDTM/ADaM XPT Files","text":"","code":"devtools::install_github(\"https://github.com/atorus-research/xportr.git\", ref = \"devel\")"},{"path":"https://atorus-research.github.io/xportr/dev/index.html","id":"what-is-xportr","dir":"","previous_headings":"","what":"What is xportr?","title":"Utilities to Output CDISC SDTM/ADaM XPT Files","text":"xportr designed clinical programmers create CDISC compliant xpt files- ADaM SDTM. Essentially, package two big components Writing xpt files well-defined metadata Checking compliance data sets. first set tools designed allow clinical programmer build CDISC compliant xpt file directly R. second set tools perform checks data sets send validators data reviewers.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/index.html","id":"what-are-the-checks","dir":"","previous_headings":"","what":"What are the checks?","title":"Utilities to Output CDISC SDTM/ADaM XPT Files","text":"Variable names must start letter (underscore), comprised uppercase letters (-Z), numerals (0-9) free non-ASCII characters, symbols, underscores. Allotted length column containing character (text) data set maximum length variable used across data sets (≤ 200) Coerces variables numeric character types Display format support numeric float date/time values Variables names ≤ 8 characters. Variable labels ≤ 40 characters. Data set labels ≤ 40 characters. Presence non-ASCII characters Variable Names, Labels data set labels. NOTE: check associated messages warning.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/index.html","id":"simple-example","dir":"","previous_headings":"","what":"Simple Example","title":"Utilities to Output CDISC SDTM/ADaM XPT Files","text":"Objective: Create fully compliant v5 xpt ADSL dataset developed using R. need following: Apply types Apply lengths Apply variable labels Apply formats Re-order variables Apply dataset label Write version 5 xpt file can done using well-defined specification file xportr package! First start ADSL dataset created R. example ADSL dataset taken {admiral} package. script generates ADSL dataset can created using command admiral::use_ad_template(\"adsl\"). ADSL dataset 306 observations 48 variables. created dummy specification file called ADaM_admiral_spec.xlsx found specs folder package. can use system.file(paste0(\"specs/\", \"ADaM_admiral_spec.xlsx\"), package = \"xportr\") access file. xportr_ function written way take part specification file apply piece dataset. Setting verbose = \"warn\" send appropriate warning message console. suppressed warning sake brevity. xportr_metadata() function can reduce duplication setting variable specification domain explicitly top pipeline. like use verbose argument, need set function call. Furthermore, ’re calling xportr functions common metadata verbosity, can shorten simply using xportr(). ’s ! now xpt file created R appropriate types, lengths, labels, ordering formats. Please check Get Started information detailed walk xportr_ function. talks Pharma companies involved {pharmaverse} enhance package play well downstream upstream packages.","code":"library(dplyr) library(admiral) library(xportr) adsl <- admiral::admiral_adsl spec_path <- system.file(paste0(\"specs/\", \"ADaM_admiral_spec.xlsx\"), package = \"xportr\") var_spec <- readxl::read_xlsx(spec_path, sheet = \"Variables\") %>% dplyr::rename(type = \"Data Type\") %>% rlang::set_names(tolower) dataset_spec <- readxl::read_xlsx(spec_path, sheet = \"Datasets\") %>% dplyr::rename(label = \"Description\") %>% rlang::set_names(tolower) adsl %>% xportr_metadata(var_spec, \"ADSL\") %>% xportr_type(verbose = \"warn\") %>% xportr_length(verbose = \"warn\") %>% xportr_label(verbose = \"warn\") %>% xportr_order(verbose = \"warn\") %>% xportr_format() %>% xportr_df_label(dataset_spec, \"ADSL\") %>% xportr_write(\"adsl.xpt\") adsl %>% xportr_metadata(var_spec, \"ADSL\", verbose = \"warn\") %>% xportr_type() %>% xportr_length() %>% xportr_label() %>% xportr_order() %>% xportr_format() %>% xportr_df_label(dataset_spec) %>% xportr_write(\"adsl.xpt\") xportr( .df = adsl, var_metadata = var_spec, df_metadata = dataset_spec, domain = \"ADSL\", verbose = \"warn\", \"adsl.xpt\" )"},{"path":"https://atorus-research.github.io/xportr/dev/index.html","id":"references","dir":"","previous_headings":"","what":"References","title":"Utilities to Output CDISC SDTM/ADaM XPT Files","text":"package developed jointly GSK Atorus.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/pull_request_template.html","id":"thank-you-for-your-pull-request","dir":"","previous_headings":"","what":"Thank you for your Pull Request!","title":"NA","text":"developed Pull Request template aid reviewers. Completing tasks helps ensure reviewers can maximize time code well making sure xportr codebase remains robust consistent.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/pull_request_template.html","id":"the-scope-of-xportr","dir":"","previous_headings":"","what":"The scope of {xportr}","title":"NA","text":"xportr’s scope enable R users write submission compliant xpt files can delivered Health Authority downstream validation software programs. see labels, lengths, types, ordering formats dataset specification object (SDTM ADaM) primary focus. also see messaging warnings users around applying information specification file primary focus. Please make sure Pull Request meets scope {xportr}. Pull Request moves beyond scope, please get touch xportr team slack create issue discuss. Please check task box acknowledgment completed task. checklist part Github Action workflows Pull Request merged main branch checked task.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/pull_request_template.html","id":"changes-description","dir":"","previous_headings":"","what":"Changes Description","title":"NA","text":"(descriptions changes)","code":""},{"path":"https://atorus-research.github.io/xportr/dev/pull_request_template.html","id":"task-list","dir":"","previous_headings":"","what":"Task List","title":"NA","text":"spirit xportr met Pull Request Place Closes # beginning Pull Request Title (Use Edit button top-right need update) Summary changes filled Changes Description. Can removed left blank changes minor/self-explanatory. Code formatted according tidyverse style guide. Use styler package functions style files accordingly. New functions arguments follow established convention found Wiki. Updated relevant unit tests written new unit tests. See Wiki conventions used package. Creation/updated relevant roxygen headers examples. See Wiki conventions used package. Run devtools::document() .Rd files man folder NAMESPACE file project root updated appropriately Run pkgdown::build_site() check affected examples displayed correctly new/updated functions occur “Reference” page. Update NEWS.md changes pertain user-facing function (.e. @export tag) documentation aimed users (rather developers) NEWS.md entry go # xportr development version section. Don’t worry updating version auto-updated using vbump.yaml CI. Address updates needed vignettes /templates. Link issue Development Panel closes successful merging. developer responsible fixing merge conflicts Reviewer. Pat back job well done! Much love accomplishment!","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/adsl.html","id":null,"dir":"Reference","previous_headings":"","what":"Analysis Dataset Subject Level — adsl","title":"Analysis Dataset Subject Level — adsl","text":"example dataset containing subject level data","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/adsl.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Analysis Dataset Subject Level — adsl","text":"","code":"adsl"},{"path":[]},{"path":"https://atorus-research.github.io/xportr/dev/reference/adsl.html","id":"adsl","dir":"Reference","previous_headings":"","what":"adsl","title":"Analysis Dataset Subject Level — adsl","text":"data frame 254 rows 48 columns: STUDYID Study Identifier USUBJID Unique Subject Identifier SUBJID Subject Identifier Study SITEID Study Site Identifier SITEGR1 Pooled Site Group 1 ARM Description Planned Arm TRT01P Planned Treatment Period 01 TRT01PN Planned Treatment Period 01 (N) TRT01A Actual Treatment Period 01 TRT01AN Actual Treatment Period 01 (N) TRTSDT Date First Exposure Treatment TRTEDT Date Last Exposure Treatment TRTDUR Duration Treatment (days) AVGDD Avg Daily Dose (planned) CUMDOSE Cumulative Dose (planned) AGE Age AGEGR1 Pooled Age Group 1 AGEGR1N Pooled Age Group 1 (N) AGEU Age Units RACE Race RACEN Race (N) SEX Sex ETHNIC Ethnicity SAFFL Safety Population Flag ITTFL Intent--Treat Population Flag EFFFL Efficacy Population Flag COMP8FL Completers Week 8 Population Flag COMP16FL Completers Week 16 Population Flag COMP24FL Completers Week 24 Population Flag DISCONFL Subject Discontinue Study DSRAEFL Discontinued due AE DTHFL Subject Died BMIBL Baseline BMI (kg/m^2) BMIBLGR1 Pooled Baseline BMI Group 1 HEIGHTBL Baseline Height (cm) WEIGHTBL Baseline Weight (kg) EDUCLVL Years Education DISONSDT Date Onset Disease DURDIS Duration Disease (Months) DURDSGR1 Pooled Disease Duration Group 1 VISIT1DT Date Visit 1 RFSTDTC Subject Reference Start Date/Time RFENDTC Subject Reference End Date/Time VISNUMEN End Trt Visit (Vis 12 Early Term.) RFENDT Date Discontinuation/Completion DCDECOD Standardized Disposition Term DCREASCD Reason Discontinuation MMSETOT MMSE Total","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/dataset_spec.html","id":null,"dir":"Reference","previous_headings":"","what":"Example Dataset Specification — dataset_spec","title":"Example Dataset Specification — dataset_spec","text":"Example Dataset Specification","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/dataset_spec.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Example Dataset Specification — dataset_spec","text":"","code":"dataset_spec"},{"path":[]},{"path":"https://atorus-research.github.io/xportr/dev/reference/dataset_spec.html","id":"dataset-spec","dir":"Reference","previous_headings":"","what":"dataset_spec","title":"Example Dataset Specification — dataset_spec","text":"data frame 1 row 9 columns: Dataset Dataset Description Dataset description Class Dataset class Structure Logical, indicating specific structure Purpose Purpose dataset Key, Variables Join Key variables dataset Repeating Indicates dataset repeating Reference Data Reference Data Comment Additional comment","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/expect_attr_width.html","id":null,"dir":"Reference","previous_headings":"","what":"Custom expect function to test result of xportr_length — expect_attr_width","title":"Custom expect function to test result of xportr_length — expect_attr_width","text":"Custom expect function test result xportr_length","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/expect_attr_width.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Custom expect function to test result of xportr_length — expect_attr_width","text":"","code":"expect_attr_width(result, metadata_length)"},{"path":"https://atorus-research.github.io/xportr/dev/reference/expect_attr_width.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Custom expect function to test result of xportr_length — expect_attr_width","text":"result data.frame width attribute columns. metadata_length vector numeric expected lengths column width.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/expect_attr_width.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Custom expect function to test result of xportr_length — expect_attr_width","text":"first argument, invisibly.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/metadata.html","id":null,"dir":"Reference","previous_headings":"","what":"Set variable specifications and domain — xportr_metadata","title":"Set variable specifications and domain — xportr_metadata","text":"Sets metadata /domain dataset way can accessed xportr functions. used start xportr pipeline, removes need set metadata domain step individually. details format metadata, see 'Metadata' section function question.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/metadata.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set variable specifications and domain — xportr_metadata","text":"","code":"xportr_metadata(.df, metadata = NULL, domain = NULL, verbose = NULL)"},{"path":"https://atorus-research.github.io/xportr/dev/reference/metadata.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set variable specifications and domain — xportr_metadata","text":".df data frame CDISC standard. metadata data frame containing variable level metadata. See 'Metadata' section details. domain Appropriate CDSIC dataset name, e.g. ADAE, DM. Used subset metadata object. none passed, name dataset passed .df used. verbose action function takes action taken dataset function validation finds issue. See 'Messaging' section details. Options 'stop', 'warn', 'message', 'none'","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/metadata.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Set variable specifications and domain — xportr_metadata","text":".df dataset metadata domain attributes set","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/metadata.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Set variable specifications and domain — xportr_metadata","text":"","code":"metadata <- data.frame( dataset = \"test\", variable = c(\"Subj\", \"Param\", \"Val\", \"NotUsed\"), type = c(\"numeric\", \"character\", \"numeric\", \"character\"), format = NA, order = c(1, 3, 4, 2) ) adlb <- data.frame( Subj = as.character(123, 456, 789), Different = c(\"a\", \"b\", \"c\"), Val = c(\"1\", \"2\", \"3\"), Param = c(\"param1\", \"param2\", \"param3\") ) xportr_metadata(adlb, metadata, \"test\") #> Subj Different Val Param #> 1 123 a 1 param1 #> 2 123 b 2 param2 #> 3 123 c 3 param3 if (rlang::is_installed(\"magrittr\")) { library(magrittr) adlb %>% xportr_metadata(metadata, \"test\") %>% xportr_type() %>% xportr_order() } #> #> ── Variable type mismatches found. ── #> #> ✔ 2 variables coerced #> #> ── 1 variables not in spec and moved to end ── #> #> ── 2 reordered in dataset ── #> #> Subj Param Val Different #> 1 123 param1 1 a #> 2 123 param2 2 b #> 3 123 param3 3 c"},{"path":"https://atorus-research.github.io/xportr/dev/reference/minimal_metadata.html","id":null,"dir":"Reference","previous_headings":"","what":"Minimal metadata data frame mock for a ADaM dataset — minimal_metadata","title":"Minimal metadata data frame mock for a ADaM dataset — minimal_metadata","text":"Minimal metadata data frame mock ADaM dataset","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/minimal_metadata.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Minimal metadata data frame mock for a ADaM dataset — minimal_metadata","text":"","code":"minimal_metadata( dataset = FALSE, length = FALSE, label = FALSE, type = FALSE, format = FALSE, order = FALSE, dataset_name = \"adsl\", var_names = NULL )"},{"path":"https://atorus-research.github.io/xportr/dev/reference/minimal_metadata.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Minimal metadata data frame mock for a ADaM dataset — minimal_metadata","text":"dataset Flag indicates dataset column included. length Flag indicates length column included. label Flag indicates label column included. type Flag indicates type column included. format Flag indicates format column included. order Flag indicates order column included. dataset_name String name domain. var_names Character vector defines variables (rows) keep","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/minimal_metadata.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Minimal metadata data frame mock for a ADaM dataset — minimal_metadata","text":"metadata data.frame","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/minimal_table.html","id":null,"dir":"Reference","previous_headings":"","what":"Minimal data frame mock of a valid ADaM dataset — minimal_table","title":"Minimal data frame mock of a valid ADaM dataset — minimal_table","text":"function used tests.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/minimal_table.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Minimal data frame mock of a valid ADaM dataset — minimal_table","text":"","code":"minimal_table(n_rows = 3, cols = c(\"x\", \"y\"))"},{"path":"https://atorus-research.github.io/xportr/dev/reference/minimal_table.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Minimal data frame mock of a valid ADaM dataset — minimal_table","text":"n_rows Numeric value indicates number rows data frame cols Vector characters indicates columns return. default x y returned numeric contents.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/minimal_table.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Minimal data frame mock of a valid ADaM dataset — minimal_table","text":"data.frame mimicking valid ADaM dataset.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/multiple_vars_in_spec_helper.html","id":null,"dir":"Reference","previous_headings":"","what":"Test if multiple vars in spec will result in warning message — multiple_vars_in_spec_helper","title":"Test if multiple vars in spec will result in warning message — multiple_vars_in_spec_helper","text":"Test multiple vars spec result warning message","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/multiple_vars_in_spec_helper.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Test if multiple vars in spec will result in warning message — multiple_vars_in_spec_helper","text":"","code":"multiple_vars_in_spec_helper(FUN)"},{"path":"https://atorus-research.github.io/xportr/dev/reference/multiple_vars_in_spec_helper2.html","id":null,"dir":"Reference","previous_headings":"","what":"Test if multiple vars in spec with appropriate — multiple_vars_in_spec_helper2","title":"Test if multiple vars in spec with appropriate — multiple_vars_in_spec_helper2","text":"Test multiple vars spec appropriate","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/multiple_vars_in_spec_helper2.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Test if multiple vars in spec with appropriate — multiple_vars_in_spec_helper2","text":"","code":"multiple_vars_in_spec_helper2(FUN)"},{"path":"https://atorus-research.github.io/xportr/dev/reference/var_spec.html","id":null,"dir":"Reference","previous_headings":"","what":"Example Dataset Variable Specification — var_spec","title":"Example Dataset Variable Specification — var_spec","text":"Example Dataset Variable Specification","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/var_spec.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Example Dataset Variable Specification — var_spec","text":"","code":"var_spec"},{"path":[]},{"path":"https://atorus-research.github.io/xportr/dev/reference/var_spec.html","id":"var-spec","dir":"Reference","previous_headings":"","what":"var_spec","title":"Example Dataset Variable Specification — var_spec","text":"data frame 216 rows 19 columns: Order Order variable Dataset Dataset Variable Variable Label Variable Label Data Type Data Type Length Variable Length Significant Digits Significant Digits Format Variable Format Mandatory Mandatory Variable Flag Assigned Value Variable Assigned Value Codelist Variable Codelist Common Common Variable Flag Origin Variable Origin Pages Pages Method Variable Method Predecessor Variable Predecessor Role Variable Role Comment Comment Developer Notes Developer Notes","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr-package.html","id":null,"dir":"Reference","previous_headings":"","what":"The xportr package — xportr-package","title":"The xportr package — xportr-package","text":"xportr designed clinical workflow friendly method outputting CDISC complaint data sets R, XPT version 5 files. designed options mind allow flexible setting options allowing projects system administrators set sensible defaults organizations workflows. list options can set customize xportr works environment.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr-package.html","id":"xportr-options","dir":"Reference","previous_headings":"","what":"xportr options","title":"The xportr package — xportr-package","text":"xportr.df_domain_name - name domain \"name\" column dataset metadata. Default: \"dataset\" xportr.df_label - column noting dataset label dataset metadata. Default: \"label\" xportr.domain_name - name domain \"name\" column variable metadata. Default: \"dataset\" xportr.variable_name - name variable \"name\" variable metadata. Default: \"variable\" xportr.type_name - name variable type column variable metadata. Default: \"type\" xportr.label - name variable label column variable metadata. Default: \"label\" xportr.length - name variable length column variable metadata. Default: \"length\" xportr.order_name - name variable order column variable metadata. Default: \"order\" xportr.format_name - name variable format column variable metadata. Default: \"format\" xportr.format_verbose - default argument 'verbose' argument xportr_format. Default: \"none\" xportr.label_verbose - default argument 'verbose' argument xportr_label. Default: \"none\" xportr.length_verbose - default argument 'verbose' argument xportr_length. Default: \"none\" xportr.type_verbose - default argument 'verbose' argument xportr_type. Default: \"none\" xportr.character_types - default character vector used explicitly coerce R classes character XPT types. Default: \"character\" xportr.character_metadata_types - default character vector used explicitly coerce R classes character XPT types. Default: c(\"character\", \"char\", \"text\", \"date\", \"posixct\", \"posixt\", \"datetime\", \"time\", \"partialdate\", \"partialtime\", \"partialdatetime\", \"incompletedatetime\", \"durationdatetime\", \"intervaldatetime\")` xportr.numeric_metadata_types - default character vector used explicitly coerce R classes numeric XPT types. Default: c(\"integer\", \"numeric\", \"num\", \"float\") xportr.numeric_types - default character vector used explicitly coerce R classes numeric XPT types. Default: c(\"integer\", \"float\", \"numeric\", \"posixct\", \"posixt\", \"time\", \"date\")","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr-package.html","id":"updating-options","dir":"Reference","previous_headings":"","what":"Updating Options","title":"The xportr package — xportr-package","text":"single session, option can changed option( = ) change option single projects across sessions projects, place options update .Rprofile project directory. change option user across sessions, place options update .Rprofile file users home directory. change option users R environment, place options update .Rprofile.site file R home directory.","code":""},{"path":[]},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"The xportr package — xportr-package","text":"Maintainer: Eli Miller Eli.Miller@AtorusResearch.com (ORCID) Authors: Vignesh Thanikachalam Ben Straub Ross Didenko Zelos Zhu Ethan Brockmann Vedha Viyash Andre Verissimo Sophie Shapcott Celine Piraux Adrian Chan Sadchla Mascary contributors: Atorus/GSK JPT [copyright holder]","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr.html","id":null,"dir":"Reference","previous_headings":"","what":"Wrapper to apply all core xportr functions and write xpt — xportr","title":"Wrapper to apply all core xportr functions and write xpt — xportr","text":"Wrapper apply core xportr functions write xpt","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Wrapper to apply all core xportr functions and write xpt — xportr","text":"","code":"xportr( .df, var_metadata = NULL, df_metadata = NULL, domain = NULL, verbose = NULL, path, strict_checks = FALSE )"},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Wrapper to apply all core xportr functions and write xpt — xportr","text":".df data frame CDISC standard. var_metadata data frame containing variable level metadata df_metadata data frame containing dataset level metadata. domain Appropriate CDSIC dataset name, e.g. ADAE, DM. Used subset metadata object. none passed, name dataset passed .df used. verbose action function takes action taken dataset function validation finds issue. See 'Messaging' section details. Options 'stop', 'warn', 'message', 'none' path Path transport file written. File name sans used xpt name. strict_checks TRUE, xpt validation report errors write dataset. FALSE, xpt validation report warnings continue writing dataset. Defaults FALSE","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Wrapper to apply all core xportr functions and write xpt — xportr","text":"Returns input dataframe invisibly","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Wrapper to apply all core xportr functions and write xpt — xportr","text":"","code":"library(magrittr) test_dir <- tempdir() pipeline_path <- file.path(test_dir, \"adslpipe.xpt\") xportr_path <- file.path(test_dir, \"adslxptr.xpt\") dataset_spec_low <- setNames(dataset_spec, tolower(names(dataset_spec))) names(dataset_spec_low)[[2]] <- \"label\" var_spec_low <- setNames(var_spec, tolower(names(var_spec))) names(var_spec_low)[[5]] <- \"type\" adsl %>% xportr_metadata(var_spec_low, \"ADSL\", verbose = \"none\") %>% xportr_type() %>% xportr_length() %>% xportr_label() %>% xportr_order() %>% xportr_format() %>% xportr_df_label(dataset_spec_low) %>% xportr_write(pipeline_path) #> ── Variable lengths missing from metadata. ── #> #> ✔ 2 lengths resolved #> #> ── Variable labels missing from metadata. ── #> #> ✔ 2 labels skipped #> #> ── 2 variables not in spec and moved to end ── #> #> ── 36 reordered in dataset ── #> # `xportr()` can be used to apply a whole pipeline at once xportr( adsl, var_metadata = var_spec_low, df_metadata = dataset_spec_low, domain = \"ADSL\", verbose = \"none\", path = xportr_path ) #> ── Variable lengths missing from metadata. ── #> #> ✔ 2 lengths resolved #> #> ── Variable labels missing from metadata. ── #> #> ✔ 2 labels skipped #> #> ── 2 variables not in spec and moved to end ── #> #> ── 36 reordered in dataset ── #>"},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_df_label.html","id":null,"dir":"Reference","previous_headings":"","what":"Assign Dataset Label — xportr_df_label","title":"Assign Dataset Label — xportr_df_label","text":"Assigns dataset label dataset level metadata given data frame. stored 'label' attribute dataframe.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_df_label.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Assign Dataset Label — xportr_df_label","text":"","code":"xportr_df_label(.df, metadata = NULL, domain = NULL, metacore = deprecated())"},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_df_label.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Assign Dataset Label — xportr_df_label","text":".df data frame CDISC standard. metadata data frame containing dataset. See 'Metadata' section details. domain Appropriate CDSIC dataset name, e.g. ADAE, DM. Used subset metadata object. none passed, name dataset passed .df used. metacore Previously used pass metadata now renamed metadata","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_df_label.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Assign Dataset Label — xportr_df_label","text":"Data frame label attributes.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_df_label.html","id":"metadata","dir":"Reference","previous_headings":"","what":"Metadata","title":"Assign Dataset Label — xportr_df_label","text":"argument passed 'metadata' argument can either metacore object, data.frame containing data listed . metacore used, changes options required. data.frame 'metadata' arguments two columns must present: Domain Name - passed 'xportr.df_domain_name' option. Default: \"dataset\". column subset 'domain' argument function. Label Name - passed 'xportr.df_label' option. Default: \"label\". Character values update 'label' attribute dataframe passed haven::write_xpt note label.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_df_label.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Assign Dataset Label — xportr_df_label","text":"","code":"adsl <- data.frame( USUBJID = c(1001, 1002, 1003), SITEID = c(001, 002, 003), AGE = c(63, 35, 27), SEX = c(\"M\", \"F\", \"M\") ) metadata <- data.frame( dataset = c(\"adsl\", \"adae\"), label = c(\"Subject-Level Analysis\", \"Adverse Events Analysis\") ) adsl <- xportr_df_label(adsl, metadata, domain = \"adsl\")"},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_format.html","id":null,"dir":"Reference","previous_headings":"","what":"Assign SAS Format — xportr_format","title":"Assign SAS Format — xportr_format","text":"Assigns SAS format variable level metadata given data frame. format found given variable, set empty character vector. stored 'format.sas' attribute.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_format.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Assign SAS Format — xportr_format","text":"","code":"xportr_format(.df, metadata = NULL, domain = NULL, metacore = deprecated())"},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_format.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Assign SAS Format — xportr_format","text":".df data frame CDISC standard. metadata data frame containing variable level metadata. See 'Metadata' section details. domain Appropriate CDSIC dataset name, e.g. ADAE, DM. Used subset metadata object. none passed, name dataset passed .df used. metacore Previously used pass metadata now renamed metadata","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_format.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Assign SAS Format — xportr_format","text":"Data frame SASformat attributes variable.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_format.html","id":"metadata","dir":"Reference","previous_headings":"","what":"Metadata","title":"Assign SAS Format — xportr_format","text":"argument passed 'metadata' argument can either metacore object, data.frame containing data listed . metacore used, changes options required. data.frame 'metadata' arguments three columns must present: Domain Name - passed 'xportr.domain_name' option. Default: \"dataset\". column subset 'domain' argument function. Format Name - passed 'xportr.format_name' option. Default: \"format\". Character values update 'format.sas' attribute column. passed haven::write note format. Variable Name - passed 'xportr.variable_name' option. Default: \"variable\". used match columns '.df' argument metadata.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_format.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Assign SAS Format — xportr_format","text":"","code":"adsl <- data.frame( USUBJID = c(1001, 1002, 1003), BRTHDT = c(1, 1, 2) ) metadata <- data.frame( dataset = c(\"adsl\", \"adsl\"), variable = c(\"USUBJID\", \"BRTHDT\"), format = c(NA, \"DATE9.\") ) adsl <- xportr_format(adsl, metadata, domain = \"adsl\")"},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_label.html","id":null,"dir":"Reference","previous_headings":"","what":"Assign Variable Label — xportr_label","title":"Assign Variable Label — xportr_label","text":"Assigns variable label variable level metadata given data frame. function give detect label greater 40 characters allowed XPT v5. labels present variable assigned empty character value. Labels stored 'label' attribute column.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_label.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Assign Variable Label — xportr_label","text":"","code":"xportr_label( .df, metadata = NULL, domain = NULL, verbose = NULL, metacore = deprecated() )"},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_label.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Assign Variable Label — xportr_label","text":".df data frame CDISC standard. metadata data frame containing variable level metadata. See 'Metadata' section details. domain Appropriate CDSIC dataset name, e.g. ADAE, DM. Used subset metadata object. none passed, name dataset passed .df used. verbose action function takes action taken dataset function validation finds issue. See 'Messaging' section details. Options 'stop', 'warn', 'message', 'none' metacore Previously used pass metadata now renamed metadata","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_label.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Assign Variable Label — xportr_label","text":"Data frame label attributes variable.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_label.html","id":"messaging","dir":"Reference","previous_headings":"","what":"Messaging","title":"Assign Variable Label — xportr_label","text":"label_log() primary messaging tool xportr_label(). columns present '.df' noted metadata, assigned label message generated noting number variables assigned label. variables found metadata value passed 'verbose' argument 'stop', 'warn', 'message', message generated detailing variables missing metadata.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_label.html","id":"metadata","dir":"Reference","previous_headings":"","what":"Metadata","title":"Assign Variable Label — xportr_label","text":"argument passed 'metadata' argument can either metacore object, data.frame containing data listed . metacore used, changes options required. data.frame 'metadata' arguments three columns must present: Domain Name - passed 'xportr.domain_name' option. Default: \"dataset\". column subset 'domain' argument function. Variable Name - passed 'xportr.variable_name' option. Default: \"variable\". used match columns '.df' argument metadata. Variable Label - passed 'xportr.label' option. Default: \"label\". character values update 'label' attribute column. passed haven::write note label.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_label.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Assign Variable Label — xportr_label","text":"","code":"adsl <- data.frame( USUBJID = c(1001, 1002, 1003), SITEID = c(001, 002, 003), AGE = c(63, 35, 27), SEX = c(\"M\", \"F\", \"M\") ) metadata <- data.frame( dataset = \"adsl\", variable = c(\"USUBJID\", \"SITEID\", \"AGE\", \"SEX\"), label = c(\"Unique Subject Identifier\", \"Study Site Identifier\", \"Age\", \"Sex\") ) adsl <- xportr_label(adsl, metadata, domain = \"adsl\")"},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_length.html","id":null,"dir":"Reference","previous_headings":"","what":"Assign SAS Length — xportr_length","title":"Assign SAS Length — xportr_length","text":"Assigns SAS length specified data frame, either metadata object based calculated maximum data length. length present variable length value set 200 character columns, 8 non-character columns. value stored 'width' attribute column.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_length.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Assign SAS Length — xportr_length","text":"","code":"xportr_length( .df, metadata = NULL, domain = NULL, verbose = NULL, length_source = c(\"metadata\", \"data\"), metacore = deprecated() )"},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_length.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Assign SAS Length — xportr_length","text":".df data frame CDISC standard. metadata data frame containing variable level metadata. See 'Metadata' section details. domain Appropriate CDSIC dataset name, e.g. ADAE, DM. Used subset metadata object. none passed, name dataset passed .df used. verbose action function takes action taken dataset function validation finds issue. See 'Messaging' section details. Options 'stop', 'warn', 'message', 'none' length_source Choose assigned length either metadata data. \"metadata\" specified, assigned length metadata length. \"data\" specified, assigned length determined calculated maximum data length. Permitted Values: \"metadata\", \"data\" metacore Previously used pass metadata now renamed metadata","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_length.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Assign SAS Length — xportr_length","text":"Data frame SAS default length attributes variable.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_length.html","id":"messaging","dir":"Reference","previous_headings":"","what":"Messaging","title":"Assign SAS Length — xportr_length","text":"length_log primary messaging tool xportr_length. columns present '.df' noted metadata, assigned length message generated noting number variables assigned length. variables found metadata value passed 'verbose' argument 'stop', 'warn', 'message', message generated detailing variables missing metadata.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_length.html","id":"metadata","dir":"Reference","previous_headings":"","what":"Metadata","title":"Assign SAS Length — xportr_length","text":"argument passed 'metadata' argument can either {metacore} object, data.frame containing data listed . metacore used, changes options required. data.frame 'metadata' arguments three columns must present: Domain Name - passed 'xportr.domain_name' option. Default: \"dataset\". column subset 'domain' argument function. Variable Name - passed 'xportr.variable_name' option. Default: \"variable\". used match columns '.df' argument metadata. Variable Label - passed 'xportr.length' option. Default: \"length\". numeric values update 'width' attribute column. passed haven::write note variable length.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_length.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Assign SAS Length — xportr_length","text":"","code":"adsl <- data.frame( USUBJID = c(1001, 1002, 1003), BRTHDT = c(1, 1, 2) ) metadata <- data.frame( dataset = c(\"adsl\", \"adsl\"), variable = c(\"USUBJID\", \"BRTHDT\"), length = c(10, 8) ) adsl <- xportr_length(adsl, metadata, domain = \"adsl\", length_source = \"metadata\")"},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_options.html","id":null,"dir":"Reference","previous_headings":"","what":"Get or set xportr options — xportr_options","title":"Get or set xportr options — xportr_options","text":"two mechanisms working options xportr. One options() function, part base R, xportr_options() function, xportr package. reason two mechanisms legacy code scoping. options() function sets options globally, duration R process. getOption() function retrieves value option. xportr related options type prefixed \"xportr.\".","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_options.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get or set xportr options — xportr_options","text":"","code":"xportr_options(...)"},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_options.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get or set xportr options — xportr_options","text":"... Options set, form name = value character vector option names.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_options.html","id":"options-with-options-","dir":"Reference","previous_headings":"","what":"Options with options()","title":"Get or set xportr options — xportr_options","text":"xportr.df_domain_name defaults \"dataset\" xportr.df_label defaults \"label\" xportr.domain_name defaults \"dataset\" xportr.variable_name defaults \"variable\" xportr.type_name defaults \"type\" xportr.label defaults \"label\" xportr.length defaults \"length\" xportr.order_name defaults \"order\" xportr.format_name defaults \"format\" xportr.format_verbose defaults \"none\" xportr.label_verbose defaults \"none\" xportr.length_verbose defaults \"none\" xportr.type_verbose defaults \"label\" xportr.character_types defaults \"character\" xportr.character_metadata_types defaults c(\"character\", \"char\", \"text\", \"date\", \"posixct\", \"posixt\", \"datetime\", \"time\", \"partialdate\", \"partialtime\", \"partialdatetime\", \"incompletedatetime\", \"durationdatetime\", \"intervaldatetime\") xportr.numeric_metadata_types defaults c(\"integer\", \"numeric\", \"num\", \"float\") xportr.numeric_types defaults c(\"integer\", \"float\", \"numeric\", \"posixct\", \"posixt\", \"time\", \"date\")","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_options.html","id":"options-with-xportr-options-","dir":"Reference","previous_headings":"","what":"Options with xportr_options()","title":"Get or set xportr options — xportr_options","text":"Alternative options(), xportr_options() function can used set options. xportr_options() function also returns current options character vector options keys passed . nothing passed , returns state xportr options.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_options.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get or set xportr options — xportr_options","text":"","code":"xportr_options(\"xportr.df_label\") #> $xportr.df_label #> [1] \"label\" #> xportr_options(xportr.df_label = \"data_label\", xportr.label = \"custom_label\") xportr_options(c(\"xportr.label\", \"xportr.df_label\")) #> $xportr.label #> [1] \"custom_label\" #> #> $xportr.df_label #> [1] \"data_label\" #> xportr_options() #> $xportr.df_domain_name #> [1] \"dataset\" #> #> $xportr.df_label #> [1] \"data_label\" #> #> $xportr.domain_name #> [1] \"dataset\" #> #> $xportr.variable_name #> [1] \"variable\" #> #> $xportr.type_name #> [1] \"type\" #> #> $xportr.label #> [1] \"custom_label\" #> #> $xportr.length #> [1] \"length\" #> #> $xportr.order_name #> [1] \"order\" #> #> $xportr.format_name #> [1] \"format\" #> #> $xportr.format_verbose #> [1] \"none\" #> #> $xportr.label_verbose #> [1] \"none\" #> #> $xportr.length_verbose #> [1] \"none\" #> #> $xportr.type_verbose #> [1] \"none\" #> #> $xportr.character_types #> [1] \"character\" #> #> $xportr.character_metadata_types #> [1] \"character\" \"char\" \"text\" #> [4] \"date\" \"posixct\" \"posixt\" #> [7] \"datetime\" \"time\" \"partialdate\" #> [10] \"partialtime\" \"partialdatetime\" \"incompletedatetime\" #> [13] \"durationdatetime\" \"intervaldatetime\" #> #> $xportr.numeric_metadata_types #> [1] \"integer\" \"numeric\" \"num\" \"float\" #> #> $xportr.numeric_types #> [1] \"integer\" \"float\" \"numeric\" \"posixct\" \"posixt\" \"time\" \"date\" #>"},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_options_list.html","id":null,"dir":"Reference","previous_headings":"","what":"A list with all the supported options of xportr — xportr_options_list","title":"A list with all the supported options of xportr — xportr_options_list","text":"internal list supported options xportr defaults","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_options_list.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"A list with all the supported options of xportr — xportr_options_list","text":"","code":"xportr_options_list"},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_options_list.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"A list with all the supported options of xportr — xportr_options_list","text":"object class list length 17.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_order.html","id":null,"dir":"Reference","previous_headings":"","what":"Order variables of a dataset according to Spec — xportr_order","title":"Order variables of a dataset according to Spec — xportr_order","text":"dplyr::arrange() function used order columns dataframe. variables missing order value appended end dataframe variables order.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_order.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Order variables of a dataset according to Spec — xportr_order","text":"","code":"xportr_order( .df, metadata = NULL, domain = NULL, verbose = NULL, metacore = deprecated() )"},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_order.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Order variables of a dataset according to Spec — xportr_order","text":".df data frame CDISC standard. metadata data frame containing variable level metadata. See 'Metadata' section details. domain Appropriate CDSIC dataset name, e.g. ADAE, DM. Used subset metadata object. none passed, name dataset passed .df used. verbose action function takes action taken dataset function validation finds issue. See 'Messaging' section details. Options 'stop', 'warn', 'message', 'none' metacore Previously used pass metadata now renamed metadata","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_order.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Order variables of a dataset according to Spec — xportr_order","text":"Dataframe re-ordered according spec","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_order.html","id":"messaging","dir":"Reference","previous_headings":"","what":"Messaging","title":"Order variables of a dataset according to Spec — xportr_order","text":"var_ord_msg() primary messaging tool xportr_order(). two primary messages output var_ord_msg(). first \"moved\" variables. variables found metadata file moved end dataset. message generated noting number, , variables moved end dataset. variables moved, 'verbose' argument 'stop', 'warn', 'message', message generated detailing variables moved. second primary message number variables dataset, correct order. message generated noting number, , variables reordered. variables reordered, 'verbose' argument 'stop', 'warn', 'message', message generated detailing variables reordered.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_order.html","id":"metadata","dir":"Reference","previous_headings":"","what":"Metadata","title":"Order variables of a dataset according to Spec — xportr_order","text":"argument passed 'metadata' argument can either metacore object, data.frame containing data listed . metacore used, changes options required. data.frame 'metadata' arguments three columns must present: Domain Name - passed 'xportr.domain_name' option. Default: \"dataset\". column subset 'domain' argument function. Variable Name - passed 'xportr.variable_name' option. Default: \"variable\". used match columns '.df' argument metadata. Variable Order - passed 'xportr.order_name' option. Default: \"order\". values used arrange order variables. values order metadata numeric, coerced prevent alphabetical sorting numeric values.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_order.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Order variables of a dataset according to Spec — xportr_order","text":"","code":"adsl <- data.frame( BRTHDT = c(1, 1, 2), STUDYID = c(\"mid987650\", \"mid987650\", \"mid987650\"), TRT01A = c(\"Active\", \"Active\", \"Placebo\"), USUBJID = c(1001, 1002, 1003) ) metadata <- data.frame( dataset = c(\"adsl\", \"adsl\", \"adsl\", \"adsl\"), variable = c(\"STUDYID\", \"USUBJID\", \"TRT01A\", \"BRTHDT\"), order = 1:4 ) adsl <- xportr_order(adsl, metadata, domain = \"adsl\") #> ── All variables in specification file are in dataset ── #> #> ── 3 reordered in dataset ── #>"},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_type.html","id":null,"dir":"Reference","previous_headings":"","what":"Coerce variable type — xportr_type","title":"Coerce variable type — xportr_type","text":"XPT v5 datasets data types character numeric. xportr_type attempts collapse R classes two XPT types. 'xportr.character_types' option used explicitly collapse class column character using .character. Similarly, 'xportr.numeric_types' collapse column numeric type. type passed variable, assumed numeric coerced .numeric().","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_type.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Coerce variable type — xportr_type","text":"","code":"xportr_type( .df, metadata = NULL, domain = NULL, verbose = NULL, metacore = deprecated() )"},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_type.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Coerce variable type — xportr_type","text":".df data frame CDISC standard. metadata data frame containing variable level metadata. See 'Metadata' section details. domain Appropriate CDSIC dataset name, e.g. ADAE, DM. Used subset metadata object. none passed, name dataset passed .df used. verbose action function takes action taken dataset function validation finds issue. See 'Messaging' section details. Options 'stop', 'warn', 'message', 'none' metacore Previously used pass metadata now renamed metadata","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_type.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Coerce variable type — xportr_type","text":"Returns modified table.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_type.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Coerce variable type — xportr_type","text":"Certain care taken using timing variables. R serializes dates based reference date 01/01/1970 XPT uses 01/01/1960. can result dates 10 years outputting R XPT using date class. reason, xportr try determine happen variables appear used denote time.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_type.html","id":"messaging","dir":"Reference","previous_headings":"","what":"Messaging","title":"Coerce variable type — xportr_type","text":"type_log() primary messaging tool xportr_type(). number column types mismatch reported type metadata, , reported xportr_type(). type mismatches, 'verbose' argument 'stop', 'warn', 'message', mismatch detailed actual type data type noted metadata.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_type.html","id":"metadata","dir":"Reference","previous_headings":"","what":"Metadata","title":"Coerce variable type — xportr_type","text":"argument passed 'metadata' argument can either metacore object, data.frame containing data listed . metacore used, changes options required. data.frame 'metadata' arguments four columns must present: Domain Name - passed 'xportr.domain_name' option. Default: \"dataset\". column subset 'domain' argument function. Variable Name - passed 'xportr.variable_name' option. Default: \"variable\". used match columns '.df' argument metadata. Variable Type - passed 'xportr.type_name'. Default: \"type\". used note XPT variable \"type\" options numeric character. (Option ) Character Types - list classes explicitly coerced XPT Character type. Default: c( \"character\", \"char\", \"text\", \"date\", \"posixct\", \"posixt\", \"datetime\", \"time\", \"partialdate\", \"partialtime\", \"partialdatetime\", \"incompletedatetime\", \"durationdatetime\", \"intervaldatetime\")` (Option ) Numeric Types - list classes explicitly coerced XPT numeric type. Default: c(\"integer\", \"numeric\", \"num\", \"float\")","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_type.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Coerce variable type — xportr_type","text":"","code":"metadata <- data.frame( dataset = \"test\", variable = c(\"Subj\", \"Param\", \"Val\", \"NotUsed\"), type = c(\"numeric\", \"character\", \"numeric\", \"character\") ) .df <- data.frame( Subj = as.character(123, 456, 789), Different = c(\"a\", \"b\", \"c\"), Val = c(\"1\", \"2\", \"3\"), Param = c(\"param1\", \"param2\", \"param3\") ) df2 <- xportr_type(.df, metadata, \"test\") #> ── Variable type mismatches found. ── #> #> ✔ 2 variables coerced"},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_write.html","id":null,"dir":"Reference","previous_headings":"","what":"Write xpt v5 transport file — xportr_write","title":"Write xpt v5 transport file — xportr_write","text":"Writes local data frame SAS transport file version 5. SAS transport format open format, required submission data FDA.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_write.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Write xpt v5 transport file — xportr_write","text":"","code":"xportr_write( .df, path, metadata = NULL, domain = NULL, strict_checks = FALSE, label = deprecated() )"},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_write.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Write xpt v5 transport file — xportr_write","text":".df data frame write. path Path transport file written. File name sans used xpt name. metadata data frame containing dataset. See 'Metadata' section details. domain Appropriate CDSIC dataset name, e.g. ADAE, DM. Used subset metadata object. none passed, name dataset passed .df used. strict_checks TRUE, xpt validation report errors write dataset. FALSE, xpt validation report warnings continue writing dataset. Defaults FALSE label Previously used set Dataset label. Use metadata argument set dataset label.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_write.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Write xpt v5 transport file — xportr_write","text":"data frame. xportr_write() returns input data invisibly.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_write.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Write xpt v5 transport file — xportr_write","text":"Variable dataset labels stored \"label\" attribute. SAS format stored \"SASformat\" attribute. SAS type based metadata attribute.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_write.html","id":"metadata","dir":"Reference","previous_headings":"","what":"Metadata","title":"Write xpt v5 transport file — xportr_write","text":"argument passed 'metadata' argument can either metacore object, data.frame containing data listed . metacore used, changes options required. data.frame 'metadata' arguments two columns must present: Domain Name - passed 'xportr.df_domain_name' option. Default: \"dataset\". column subset 'domain' argument function. Label Name - passed 'xportr.df_label' option. Default: \"label\". Character values update 'label' attribute dataframe passed haven::write_xpt note label.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xportr_write.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Write xpt v5 transport file — xportr_write","text":"","code":"adsl <- data.frame( SUBL = as.character(123, 456, 789), DIFF = c(\"a\", \"b\", \"c\"), VAL = c(\"1\", \"2\", \"3\"), PARAM = c(\"param1\", \"param2\", \"param3\") ) var_spec <- data.frame( dataset = \"adsl\", label = \"Subject-Level Analysis Dataset\", data_label = \"ADSL\" ) xportr_write(adsl, path = paste0(tempdir(), \"/adsl.xpt\"), domain = \"adsl\", metadata = var_spec, strict_checks = FALSE )"},{"path":"https://atorus-research.github.io/xportr/dev/reference/xpt_validate.html","id":null,"dir":"Reference","previous_headings":"","what":"Validate Dataset Can be Written to xpt — xpt_validate","title":"Validate Dataset Can be Written to xpt — xpt_validate","text":"Function used validate dataframes sent haven::write_xpt writing.","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xpt_validate.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Validate Dataset Can be Written to xpt — xpt_validate","text":"","code":"xpt_validate(data)"},{"path":"https://atorus-research.github.io/xportr/dev/reference/xpt_validate.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Validate Dataset Can be Written to xpt — xpt_validate","text":"data Dataset exported xpt file","code":""},{"path":"https://atorus-research.github.io/xportr/dev/reference/xpt_validate.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Validate Dataset Can be Written to xpt — xpt_validate","text":"Returns character vector failed conditions","code":""}]