chooseByPriority {CALIBERdatamanage} | R Documentation |
Chooses a single item of x according to the priority order choice_order
chooseByPriority(x, choice_order)
x |
a numeric vector |
choice_order |
a numeric vector giving the order of priorities. Items near the front of the vector have higher priority. |
returns the value of choice_order with the smallest index that is in x. NA if no element of x occurs in choice_order.
Used by addToCohort
to select a single entry per patient.
addToCohort
, addCodelistToCohort
## chooseByPriority(1:4, 3:5) # returns 3 chooseByPriority(1:4, 5:7) # returns NA