derive_vars_atc: Derive ATC Class Variables

Description Usage Arguments Value Author(s) Examples

View source: R/derive_vars_transposed.R

Description

Add Anatomical Therapeutic Chemical class variables from FACM to ADCM

Usage

1
2
3
4
5
derive_vars_atc(
  dataset,
  dataset_facm,
  by_vars = vars(USUBJID, CMREFID = FAREFID)
)

Arguments

dataset

Input dataset

The variables specified by the by_vars parameter are required

dataset_facm

FACM dataset

The variables specified by the by_vars parameter, FAGRPID, FATESTCD and FASTRESC are required

by_vars

Keys used to merge dataset_facm with dataset

Permitted Values: list of variables

Value

The input dataset with ATC variables added

Author(s)

Thomas Neitmann

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
cm <- tibble::tribble(
        ~USUBJID, ~CMGRPID,  ~CMREFID,            ~CMDECOD,
  "BP40257-1001",     "14", "1192056",       "PARACETAMOL",
  "BP40257-1001",     "18", "2007001",        "SOLUMEDROL",
  "BP40257-1002",     "19", "2791596",    "SPIRONOLACTONE"
)
facm <- tibble::tribble(
        ~USUBJID, ~FAGRPID,  ~FAREFID,   ~FATESTCD, ~FASTRESC,
  "BP40257-1001",      "1", "1192056",  "CMATC1CD",       "N",
  "BP40257-1001",      "1", "1192056",  "CMATC2CD",     "N02",
  "BP40257-1001",      "1", "1192056",  "CMATC3CD",    "N02B",
  "BP40257-1001",      "1", "1192056",  "CMATC4CD",   "N02BE",

  "BP40257-1001",      "1", "2007001",  "CMATC1CD",       "D",
  "BP40257-1001",      "1", "2007001",  "CMATC2CD",     "D10",
  "BP40257-1001",      "1", "2007001",  "CMATC3CD",    "D10A",
  "BP40257-1001",      "1", "2007001",  "CMATC4CD",   "D10AA",
  "BP40257-1001",      "2", "2007001",  "CMATC1CD",       "D",
  "BP40257-1001",      "2", "2007001",  "CMATC2CD",     "D07",
  "BP40257-1001",      "2", "2007001",  "CMATC3CD",    "D07A",
  "BP40257-1001",      "2", "2007001",  "CMATC4CD",   "D07AA",
  "BP40257-1001",      "3", "2007001",  "CMATC1CD",       "H",
  "BP40257-1001",      "3", "2007001",  "CMATC2CD",     "H02",
  "BP40257-1001",      "3", "2007001",  "CMATC3CD",    "H02A",
  "BP40257-1001",      "3", "2007001",  "CMATC4CD",   "H02AB",

  "BP40257-1002",      "1", "2791596",  "CMATC1CD",       "C",
  "BP40257-1002",      "1", "2791596",  "CMATC2CD",     "C03",
  "BP40257-1002",      "1", "2791596",  "CMATC3CD",    "C03D",
  "BP40257-1002",      "1", "2791596",  "CMATC4CD",   "C03DA"
)

derive_vars_atc(cm, facm)

epijim/admiral documentation built on Feb. 13, 2022, 12:15 a.m.