MyNixOS website logo
Description

Tools for Clinical Data Management.

For checking the dataset from EDC(Electronic Data Capture) in clinical trials. 'dmtools' reshape your dataset in a tidy view and check events. You can reshape the dataset and choose your target to check, for example, the laboratory reference range.

dmtools

CRANstatus BuildStatus codecov

Installation

install.packages("dmtools")

# dev-version
devtools::install_github("KonstantinRyabov/dmtools")

library(dmtools)

Overview

For checking the dataset from EDC in clinical trials. Notice, your dataset should have a postfix( _V1 ) or a prefix( V1_ ) in the names of variables. Column names should be unique.

  • date() - create object date to check dates in the dataset
  • lab() - create object lab to check lab reference range
  • short() - create object short to reshape the dataset in a tidy view.
  • check() - check objects
  • get_result() - get the final result of object
  • choose_test() - filter the final result of check()
  • rename_dataset() - rename the dataset

Usage

For example, you want to check laboratory values, you need to create the excel table like in the example.

  • AGELOW - number, >= number
  • AGEHIGH - if none, type Inf, <= number
  • SEX - for both sex, use |
  • LBTEST - What was the lab test name? (can be any convenient name for you)
  • LBORRES* - What was the result of the lab test?
  • LBNRIND* - How [did/do] the reported values compare within the [reference/normal/expected] range?
  • LBORNRLO - What was the lower limit of the reference range for this lab test, >=
  • LBORNRHI - What was the high limit of the reference range for this lab test, <=

*column names without prefix or postfix

lab reference ranges
AGELOWAGEHIGHSEXLBTESTLBORRESLBNRINDLBORNRLOLBORNRHI
1845f|mGlucoseGLUCGLUC_IND3.95.9
1845mAspartate transaminaseASTAST_IND042
1845fAspartate transaminaseASTAST_IND039
dataset
IDAGESEXGLUC_V1GLUC_IND_V1AST_V2AST_IND_V2
0119f5.5norm30norm
0220m4.1NA48norm
0322m9.7norm31norm
# "norm" and "no" it is an example, necessary variable for the estimate, get from the dataset
refs <- system.file("labs_refer.xlsx", package = "dmtools")
obj_lab <- lab(refs, ID, AGE, SEX, "norm", "no")
obj_lab <- obj_lab %>% check(df)

# ok - analysis, which has a correct estimate of the result
obj_lab %>% choose_test("ok")
#>   ID AGE SEX                 LBTEST LBTESTCD VISIT LBORNRLO LBORNRHI LBORRES
#> 1 01  19   f                Glucose     GLUC   _V1      3.9      5.9     5.5
#> 2 01  19   f Aspartate transaminase      AST   _V2      0.0     39.0      30
#> 3 03  22   m Aspartate transaminase      AST   _V2      0.0     42.0      31
#>   LBNRIND RES_TYPE_NUM IND_EXPECTED
#> 1    norm          5.5         norm
#> 2    norm         30.0         norm
#> 3    norm         31.0         norm

# mis - analysis, which has an incorrect estimate of the result
obj_lab %>% choose_test("mis")
#>   ID AGE SEX                 LBTEST LBTESTCD VISIT LBORNRLO LBORNRHI LBORRES
#> 1 02  20   m Aspartate transaminase      AST   _V2      0.0     42.0      48
#> 2 03  22   m                Glucose     GLUC   _V1      3.9      5.9     9.7
#>   LBNRIND RES_TYPE_NUM IND_EXPECTED
#> 1    norm         48.0           no
#> 2    norm          9.7           no

# skip - analysis, which has an empty value of the estimate
obj_lab %>% choose_test("skip")
#>   ID AGE SEX  LBTEST LBTESTCD VISIT LBORNRLO LBORNRHI LBORRES LBNRIND
#> 1 02  20   m Glucose     GLUC   _V1      3.9      5.9     4.1    <NA>
#>   RES_TYPE_NUM IND_EXPECTED
#> 1          4.1         norm
strange_dataset
IDAGESEXV1_GLUCV1_GLUC_INDV2_ASTV2_AST_IND
0119f5,5norm< 5norm
0220m4,1NA48norm
0322m9,7norm31norm
# dmtools can work with the dataset as strange_df
# parameter is_post has value FALSE because a dataset has a prefix( V1_ ) in the names of variables
obj_lab <- lab(refs, ID, AGE, SEX, "norm", "no", is_post = F)
obj_lab <- obj_lab %>% check(strange_df)

# dmtools can understand the value with a comma like 6,6 
obj_lab %>% choose_test("ok")
#>   ID AGE SEX                 LBTEST LBTESTCD VISIT LBORNRLO LBORNRHI LBORRES
#> 1 01  19   f                Glucose     GLUC   V1_      3.9      5.9     5,5
#> 2 03  22   m Aspartate transaminase      AST   V2_      0.0     42.0      31
#>   LBNRIND RES_TYPE_NUM IND_EXPECTED
#> 1    norm          5.5         norm
#> 2    norm         31.0         norm

# Notice, if dmtools can't understand the value of lab_vals e.g. < 5, it puts Inf in the RES_TYPE_NUM
obj_lab %>% choose_test("mis")
#>   ID AGE SEX                 LBTEST LBTESTCD VISIT LBORNRLO LBORNRHI LBORRES
#> 1 01  19   f Aspartate transaminase      AST   V2_      0.0     39.0     < 5
#> 2 02  20   m Aspartate transaminase      AST   V2_      0.0     42.0      48
#> 3 03  22   m                Glucose     GLUC   V1_      3.9      5.9     9,7
#>   LBNRIND RES_TYPE_NUM IND_EXPECTED
#> 1    norm          Inf           no
#> 2    norm         48.0           no
#> 3    norm          9.7           no

obj_lab %>% choose_test("skip")
#>   ID AGE SEX  LBTEST LBTESTCD VISIT LBORNRLO LBORNRHI LBORRES LBNRIND
#> 1 02  20   m Glucose     GLUC   V1_      3.9      5.9     4,1    <NA>
#>   RES_TYPE_NUM IND_EXPECTED
#> 1          4.1         norm
Metadata

Version

0.2.6

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows