4.1 External Data
Data may be directly imported into the R environment using packages. Most often, data will take the form of Comma Separated Values (.csv
), Excel Spreadsheets (.xlsx
), SAS (.sas7bdat
) or JSON (.json
).
Package | Formats | Reference |
---|---|---|
readr | .csv, .txt | Cheat Sheet |
readxl | .xls, .xlsx | Cheat Sheet |
haven | .sas7bdat, .sas7bcat, .xpt | Package Site |
jsonlite | .json | Vignette |
4.1.1 CDISC Datasets
The PHUSE Test Datasets Factory provides a convenient set CDISC datasets in xpt
format to experiment with. You may access them through the following github repositories:
Below is an example of using the haven
package to read in adsl.xpt
directly from the ADaM repository. Note you can also chose to download these data and read them locally from your computer.
library(haven)
read_xpt("https://github.com/phuse-org/TestDataFactory/raw/main/Updated/TDF_ADaM/adsl.xpt") adsl <-
STUDYID | USUBJID | SUBJID | SITEID | SITEGR1 | ARM | TRT01P | TRT01PN | TRT01A | TRT01AN | TRTSDT | TRTEDT | TRTDURD | 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 | EOSSTT | DCSREAS | MMSETOT |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
CDISCPILOT01 | 01-701-1015 | 1015 | 701 | 701 | Placebo | Placebo | 0 | Placebo | 0 | 2014-01-02 | 2014-07-02 | 182 | 0.0 | 0 | 63 | <65 | 1 | YEARS | WHITE | 1 | F | HISPANIC OR LATINO | Y | Y | Y | Y | Y | Y | 25.1 | 25-<30 | 147.3 | 54.4 | 16 | 2010-04-30 | 43.9 |
=12 |
2013-12-26 | 2014-01-02 | 2014-07-02 | 12 | 2014-07-02 | COMPLETED | COMPLETED | 23 | ||||
CDISCPILOT01 | 01-701-1023 | 1023 | 701 | 701 | Placebo | Placebo | 0 | Placebo | 0 | 2012-08-05 | 2012-09-01 | 28 | 0.0 | 0 | 64 | <65 | 1 | YEARS | WHITE | 1 | M | HISPANIC OR LATINO | Y | Y | Y | N | N | N | Y | Y | 30.4 |
=30 |
162.6 | 80.3 | 14 | 2006-03-11 | 76.4 |
=12 |
2012-07-22 | 2012-08-05 | 2012-09-02 | 5 | 2012-09-02 | ADVERSE EVENT | DISCONTINUED | Adverse Event | 23 | |
CDISCPILOT01 | 01-701-1028 | 1028 | 701 | 701 | Xanomeline High Dose | Xanomeline High Dose | 81 | Xanomeline High Dose | 81 | 2013-07-19 | 2014-01-14 | 180 | 77.7 | 13986 | 71 | 65-80 | 2 | YEARS | WHITE | 1 | M | NOT HISPANIC OR LATINO | Y | Y | Y | Y | Y | Y | 31.4 |
=30 |
177.8 | 99.3 | 16 | 2009-12-16 | 42.8 |
=12 |
2013-07-11 | 2013-07-19 | 2014-01-14 | 12 | 2014-01-14 | COMPLETED | COMPLETED | 23 | ||||
CDISCPILOT01 | 01-701-1033 | 1033 | 701 | 701 | Xanomeline Low Dose | Xanomeline Low Dose | 54 | Xanomeline Low Dose | 54 | 2014-03-18 | 2014-03-31 | 14 | 54.0 | 756 | 74 | 65-80 | 2 | YEARS | WHITE | 1 | M | NOT HISPANIC OR LATINO | Y | Y | Y | N | N | N | Y | 28.8 | 25-<30 | 175.3 | 88.5 | 12 | 2009-08-02 | 55.3 |
=12 |
2014-03-10 | 2014-03-18 | 2014-04-14 | 5 | 2014-04-14 | STUDY TERMINATED BY SPONSOR | DISCONTINUED | Sponsor Decision | 23 | ||
CDISCPILOT01 | 01-701-1034 | 1034 | 701 | 701 | Xanomeline High Dose | Xanomeline High Dose | 81 | Xanomeline High Dose | 81 | 2014-07-01 | 2014-12-30 | 183 | 76.9 | 14067 | 77 | 65-80 | 2 | YEARS | WHITE | 1 | F | NOT HISPANIC OR LATINO | Y | Y | Y | Y | Y | Y | 26.1 | 25-<30 | 154.9 | 62.6 | 9 | 2011-09-29 | 32.9 |
=12 |
2014-06-24 | 2014-07-01 | 2014-12-30 | 12 | 2014-12-30 | COMPLETED | COMPLETED | 21 |