Description Usage Arguments Author(s) Examples
Checks if the elements of a list of named lists/classes fulfill a certain condition. If not, an error is issued and all elements of the list not fulfilling the condition are listed.
1 | assert_list_element(list, element, condition, message_text, ...)
|
list |
A list to be checked A list of named lists or classes is expected. |
element |
The name of an element of the lists/classes A character scalar is expected. |
condition |
Condition to be fulfilled The condition is evaluated for each element of the list. The element of the
lists/classes can be referred to by its name, e.g., |
message_text |
Text to be displayed in the message The text should describe the condition to be fulfilled, e.g., "For events the censor values must be zero.". |
... |
Objects required to evaluate the condition If the condition contains objects apart from the element, they have to be passed to the function. See the second example below. |
Stefan Bundfuss
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 34 35 36 | death <- event_source(
dataset_name = "adsl",
filter = DTHFL == "Y",
date = DTHDT,
set_values_to = vars(
EVNTDESC = "DEATH",
SRCDOM = "ADSL",
SRCVAR = "DTHDT"
)
)
lstalv <- censor_source(
dataset_name = "adsl",
date = LSTALVDT,
set_values_to = vars(
EVNTDESC = "LAST KNOWN ALIVE DATE",
SRCDOM = "ADSL",
SRCVAR = "LSTALVDT"
)
)
try(assert_list_element(
list = list(death, lstalv),
element = "censor",
condition = censor == 0,
message_text = "For events the censor values must be zero."
))
try(assert_list_element(
list = events,
element = "dataset_name",
condition = dataset_name %in% c("adrs", "adae"),
valid_datasets = valid_datasets,
message_text = paste0("The dataset name must be one of the following:\n",
paste(valid_datasets, collapse = ", "))
))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.