This utility function interprets any kind of index for a vector
and converts it to a positive integer index.
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 positiveIndex interprets any such index i
and converts it to the first type of index
(a vector of positive integers specifying the elements to be
included).
If argument i is missing or NULL,
it is interpreted as a missing index,
and the result is the full sequence from 1 to len.