about_short

Installation

library(dmtools)

Overview

The short() can be useful for validation, if you need to transform the dataset and create one column for a variable with different events. You also need to create the excel document, where the name and number of columns can be any. If you have common columns, pass them to a parameter common_cols of short(). Notice, don’t write common columns in the excel document. If you have the extra information e.g. the understandable name of an analysis, pass it to a parameter extra.

Usage

Some examples, where you can use short().

pregnancy test

LB
LBPERF LBORRES
preg_yn preg_res
dataset
id site sex preg_yn_e2 preg_res_e2 preg_yn_e3 preg_res_e3
01 site 01 f y neg y neg
02 site 02 m y neg y pos
03 site 03 f y neg n unnes
preg <- system.file("preg.xlsx", package = "dmtools")
obj_short <- short(preg, id, "LBORRES", c("site", "sex"))

obj_short <- obj_short %>% check(df)
obj_short %>% get_result()
#>   id    site sex LBPERF LBORRES    IDVAR VISIT
#> 1 01 site 01   f      y     neg preg_res   _e2
#> 2 01 site 01   f      y     neg preg_res   _e3
#> 3 02 site 02   m      y     neg preg_res   _e2
#> 4 02 site 02   m      y     pos preg_res   _e3
#> 5 03 site 03   f      y     neg preg_res   _e2
#> 6 03 site 03   f      n   unnes preg_res   _e3

drug type

CM
CMTRT CMDOSE
drug_type drug_amount
dataset
id drug_type_e2 drug_amount_e2 drug_type_e3 drug_amount_e3
01 type_one 2 type_one 2
02 type_two 1 type_two 1
03 type_one 2 type_one 1
drug <- system.file("drug.xlsx", package = "dmtools")
obj_short <- short(drug, id, "CMTRT")

obj_short <- obj_short %>% check(df)
obj_short %>% get_result()
#>   id    CMTRT CMDOSE     IDVAR VISIT
#> 1 01 type_one      2 drug_type   _e2
#> 2 01 type_one      2 drug_type   _e3
#> 3 02 type_two      1 drug_type   _e2
#> 4 02 type_two      1 drug_type   _e3
#> 5 03 type_one      2 drug_type   _e2
#> 6 03 type_one      1 drug_type   _e3

vital functions

VS
VSTEST_HR VSTEST_RESP
hr respr
dataset
id hr_e2 respr_e2 hr_e3 respr_e3
01 60 12 65 13
02 70 15 71 14
03 76 16 86 18
vf <- system.file("vf.xlsx", package = "dmtools")
obj_short <- short(vf, id, "VSTEST_HR")

obj_short <- obj_short %>% check(df)
obj_short %>% get_result()
#>   id VSTEST_HR VSTEST_RESP IDVAR VISIT
#> 1 01        60          12    hr   _e2
#> 2 01        65          13    hr   _e3
#> 3 02        70          15    hr   _e2
#> 4 02        71          14    hr   _e3
#> 5 03        76          16    hr   _e2
#> 6 03        86          18    hr   _e3

adverse events

AE
LBORRES LBNRIND LBCLSIG LBTEST
ast ast_norm ast_cl enzyme_ast
dataset
id ast_e2 ast_norm_e2 ast_cl_e2 ast_e3 ast_norm_e3 ast_cl_e3 ae_yn_e5 ae_desc_e5
01 32 norm NA 36 norm NA no NA
02 56 no no 80 no yes yes abnormal ast
03 60 no yes 32 norm NA no NA
ae <- system.file("ae.xlsx", package = "dmtools")
obj_short <- short(ae, id, "LBNRIND", common_cols = c("ae_yn_e5", "ae_desc_e5"), extra = "LBTEST")

obj_short <- obj_short %>% check(df)
obj_short %>% get_result()
#>   id ae_yn_e5   ae_desc_e5 LBORRES LBNRIND LBCLSIG    IDVAR VISIT     LBTEST
#> 1 01       no         <NA>      32    norm    <NA> ast_norm   _e2 enzyme_ast
#> 2 01       no         <NA>      36    norm    <NA> ast_norm   _e3 enzyme_ast
#> 3 02      yes abnormal ast      56      no      no ast_norm   _e2 enzyme_ast
#> 4 02      yes abnormal ast      80      no     yes ast_norm   _e3 enzyme_ast
#> 5 03       no         <NA>      60      no     yes ast_norm   _e2 enzyme_ast
#> 6 03       no         <NA>      32    norm    <NA> ast_norm   _e3 enzyme_ast