Usage
item(v, idx)Details
Standard R indexing yields different results depending on the input.
When either an empty vector or a NULL is passed to the indexing
operator, an empty vector is returned. However, if the index is NA,
the return value will be a vector of NAs having the same length as
the original vector. This inconsistent behavior requires special
handling whenever the index value is computed dynamically. This function is designed to create a consistent return value for a
bad index value, which is defined as NULL, NA, vector of length 0.
If any of these values are used as the index, then NA is returned
instead of an empty vector.