chooseByPriority: Chooses an item from a vector according to a defined priority...

Description Usage Arguments Value Note See Also Examples

View source: R/chooseByPriority.R

Description

Chooses a single item of x according to the priority order choice_order

Usage

1
chooseByPriority(x, choice_order)

Arguments

x

a numeric vector

choice_order

a numeric vector giving the order of priorities. Items near the front of the vector have higher priority.

Value

returns the value of choice_order with the smallest index that is in x. NA if no element of x occurs in choice_order.

Note

Used by addToCohort to select a single entry per patient.

See Also

addToCohort, addCodelistToCohort

Examples

1
2
3
##
chooseByPriority(1:4, 3:5) # returns 3
chooseByPriority(1:4, 5:7) # returns NA

CALIBERdatamanage documentation built on Nov. 23, 2021, 3 p.m.