Skip to contents

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.


assert_list_element(list, element, condition, message_text, ...)



A list to be checked

A list of named lists or classes is expected.


The name of an element of the lists/classes

A character scalar is expected.


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., censor == 0 to check the censor field of a class.


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.


An error if the condition is not meet. The input otherwise.