.get_item {cohortBuilder} | R Documentation |
Return list of objects matching provided condition.
Description
Return list of objects matching provided condition.
Usage
.get_item(list_obj, attribute, value, operator = `==`)
Arguments
list_obj |
List of R objects. |
attribute |
Object attribute name. |
value |
Object value. |
operator |
Logical operator - two-argument function taking 'list_obj' attribute value as the first one, and 'value' as the second one. |
Value
A subset of list object matching provided condition.
Examples
my_list <- list(
list(id = 1, name = "a"),
list(id = 2, name = "b")
)
.get_item(my_list, "id", 1)
.get_item(my_list, "name", c("b", "c"), identical)
[Package cohortBuilder version 0.2.0 Index]