This utility function interprets any kind of index for a vector
and converts it to a logical vector.
Suppose that x is a vector of length len
with names names(x) = nama. Then R allows the vector x
to be indexed as x[i] where i may be
a vector of positive integers between 1 and len
specifying the elements to be included;
a vector of negative integers between -1 and
-len specifying the elements to be omitted;
a logical vector of length len specifying whether each
element of x is to be included (TRUE) or excluded
(FALSE);
a character vector containing elements of
nama identifying the elements to be included;
missing (equivalent to specifying all elements of x).
The function logicalIndex interprets any such index i
and converts it to a logical vector.
If argument i is missing or NULL,
it is interpreted as a missing index,
and the result is a vector of TRUE values.