Input parameter check for subsetting operations
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.
i2index(i, length = length(i), names = NULL)
i |
|
length |
|
names |
|
integer
with the indices
Johannes Rainer
## With `i` being an `integer` i2index(c(4, 1, 3), length = 10) ## With `i` being a `logical` i2index(c(TRUE, FALSE, FALSE, TRUE, FALSE), length = 5) ## With `i` being a `character` i2index(c("b", "a", "d"), length = 5, names = c("a", "b", "c", "d", "e"))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.