Convert i
to the base type expected by vec_as_location()
or
vec_as_location2()
. The values of the subscript type are
not checked in any way (length, missingness, negative elements).
Arguments
- i
An integer, character or logical vector specifying the locations or names of the observations to get/set. Specify
TRUE
to index all elements (as inx[]
), orNULL
,FALSE
orinteger()
to index none (as inx[NULL]
).- ...
These dots are for future extensions and must be empty.
- logical, numeric, character
How to handle logical, numeric, and character subscripts.
If
"cast"
and the subscript is not one of the three base types (logical, integer or character), the subscript is cast to the relevant base type, e.g. factors are coerced to character.NULL
is treated as an empty integer vector, and is thus coercible depending on the setting ofnumeric
. Symbols are treated as character vectors and thus coercible depending on the setting ofcharacter
.If
"error"
, the subscript type is disallowed and triggers an informative error.- arg
The argument name to be displayed in error messages.
- call
The execution environment of a currently running function, e.g.
caller_env()
. The function will be mentioned in error messages as the source of the error. See thecall
argument ofabort()
for more information.