i2index
is a simple helper function to be used in subsetting functions. It
checks and converts the parameter i
, which can be of type integer
,
logical
or character
to integer vector that can be used as index for
subsetting.
Usage
i2index(i, length = length(i), names = NULL)
Arguments
- i
character
logical
orinteger
used in[i]
for subsetting.- length
integer
representing thelength
of the object to be subsetted.- names
character
with the names (rownames or similar) of the object. This is only required ifi
is of typecharacter
.