View source: R/derive_vars_params.R
derive_vars_params | R Documentation |
Creating PARAMCD
from lookup dataset and assigning PARAM
,PARAMN
,PARCAT1
,
PARCAT2
variables
derive_vars_params(dataset, lookup_dataset, merge_vars)
dataset |
Input dataset
Input dataset is expected to have variables |
lookup_dataset |
lookup dataset containing |
merge_vars |
List of Variables need to be merged from lookup dataset |
A lookup dataset is required with PARAMCD
values for every combination
of FATEST
& FAOBJ
.
PARAMCD
PARAMN
PARAMN
PARCAT1
PARCAT2
values can be assigned
from lookup dataset.
if `PARAMN` not assigned in lookup dataset then `PARAMN` is assigned with a unique number for every unique PARAM value. if `PARAM` value not assigned in lookup dataset then `PARAM` value is a combination of `FAOBJ` `FATEST` `FASTRESU` `FALOC` `FADIR` `FALAT` if `PARCAT1` value not assigned in lookup dataset then `PARCAT1` is assigned as `FACAT` if `PARCAT2` value not assigned in lookup dataset then `PARCAT2` is assigned as `FASCAT`
The output dataset contains all observations and variables of the
input dataset along with PARAM
,PARAMCD
,PARCAT1
,PARCAT2
,PARAMN
Dhivya Kanagaraj
Other der_var:
derive_var_aval_adis()
,
derive_vars_crit()
,
derive_vars_event_flag()
,
derive_vars_max_flag()
,
derive_vars_merged_vaccine()
,
derive_vars_vaxdt()
library(admiral)
library(tibble)
library(dplyr)
lookup_dataset <- tibble::tribble(
~FATESTCD, ~PARAMCD, ~PARAMN, ~FATEST, ~FAOBJ,
"SEV", "SEVREDN", 1, "Severity", "Redness",
"DIAMETER", "DIARE", 2, "Diameter", "Redness",
"MAXDIAM", "MDIRE", 3, "Maximum Diameter cm", "Redness",
"MAXTEMP", "MAXTEMP", 4, "Maximum Temperature", "Fever",
"OCCUR", "OCFEVER", 5, "Occurrence Indicator", "Fever",
"OCCUR", "OCERYTH", 6, "Occurrence Indicator", "Erythema",
"SEV", "SEVPAIN", 7, "Severity", "Pain at Injection site",
"OCCUR", "OCPAIN", 8, "Occurrence Indicator", "Pain at Injection site",
"OCCUR", "OCSWEL", 9, "Occurrence Indicator", "Swelling"
)
input <- tibble::tribble(
~USUBJID, ~FACAT, ~FASCAT, ~FATESTCD, ~FAOBJ, ~FATEST, ~FALOC, ~FALAT,
"ABC101", "REACTO", "ADMIN", "SEV", "Redness", "Severity", "ARM", "LEFT",
"ABC101", "REACTO", "ADMIN", "DIAMETER", "Redness", "Diameter", "ARM", "RIGHT",
"ABC101", "REACTO", "ADMIN", "MAXDIAM", "Redness", "Maximum Diameter", NA, NA,
"ABC101", "REACTO", "SYSTEMIC", "MAXTEMP", "Fever", "Maximum Temp", NA, NA,
"ABC101", "REACTO", "SYSTEMIC", "OCCUR", "Fever", "Occurrence", NA, NA,
"ABC101", "REACTO", "ADMIN", "OCCUR", "Erythema", "Occurrence", NA, NA,
"ABC101", "REACTO", "ADMIN", "SEV", "Swelling", "Severity", NA, NA,
"ABC101", "REACTO", "ADMIN", "OCCUR", "Swelling", "Occurrence", NA, NA,
"ABC101", "REACTO", "ADMIN", "OCCUR", "Swelling", "Occurrence", NA, NA
)
derive_vars_params(
dataset = input,
lookup_dataset = lookup_dataset,
merge_vars = exprs(PARAMCD, PARAMN)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.