A single valid value from the vector. NA if all values are invalid.
Arguments
x
A vector.
mode
The mode of the valid value to extract. "first" extracts the first valid value,
"last" extracts the last valid value, and "mid" extracts the middle valid value.
disjoint
If TRUE, the values extracted by the three modes are forced to be different.
This behavior might be desired when trying to extract different values with different modes.
The three modes extract values in the sequence: "first", "last", "mid".