Learn R Programming

vigicaen (version 0.15.5)

add_adr: Add ADR column(s) to a dataset

Description

[Stable]Creates adr columns in vigibase datasets (demo, link, drug, but also adr).

Usage

add_adr(
  .data,
  a_code,
  a_names = names(a_code),
  adr_data,
  data_type = deprecated()
)

Value

A dataset with the new adr columns. Each element of a_names will add a column with the same name in .data. The value can be 0 (the corresponding adr is absent) or 1 (the adr is present in the case if .data is demo or drug, or "this row correspond to this adr", if .data is adr or link).

Arguments

.data

The dataset to update (demo, link, drug, adr).

a_code

A named list of low level terms codes (llt_codes).

a_names

A character vector. Names for adr columns (must be the same length as adr_list), default to names(a_code)

adr_data

A data.frame containing the adr data (usually, it is adr)

data_type

[Deprecated]. Data_type is now detected internally.

Details

Low-level term codes are the preferred level of requesting in Vigibase extract case level since they capture all possible codes for a given Preferred Term. Collect low-level terms with get_llt_soc() and get_llt_smq(). You can add adr identification to a demo, a link, drug or even an adr dataset (in this latter case, you must provide adr twice, as .data and adr_data). Column names of these dataset should not have been modified from the original vigibase dataset (as created with tb_vigibase()).

See Also

add_drug(), get_llt_soc(), get_llt_smq()

Examples

Run this code
# create adr_colitis, adr_embolism and adr_pneumonitis columns in demo

# be careful, this example may overwrite your own demo dataset
demo <- demo_

a_pt_sel <- ex_$pt_sel


adr <- adr_

a_llt <-
  get_llt_soc(
  term_sel = a_pt_sel,
  term_level = "pt",
  meddra = meddra_
  )

demo <-
  demo |>
    add_adr(
      a_code = a_llt,
      adr_data = adr
    )

demo |>
  check_dm(names(a_pt_sel))

Run the code above in your browser using DataLab