Description Usage Arguments Value Author(s) Examples
Check validity of an index of a list
object.
1 | valid.arg.index(obj, x, safe = TRUE)
|
obj |
list |
x |
index or name of an element |
safe |
whether safe if an index is higher than the one of any named element |
numeric, the index.
Return numeric(0) if the name or the index does not exist or when the
index is invalid.
If safe
is FALSE, any index is valid; if safe
is TRUE,
an index is invalid when the indexed element is positionally after
another named element.
Xiaobei Zhao
1 2 3 4 5 6 7 8 9 10 | ll <- list(11,12,13,a=14,b=15,16,17,c=18,19)
valid.arg.index(ll,-1) # non-existing index
valid.arg.index(ll,0) # non-existing index
valid.arg.index(ll,1) # valid index
valid.arg.index(ll,2) # valid index
valid.arg.index(ll,5) # invalid index
valid.arg.index(ll,10) # non-existing index
valid.arg.index(ll,"a")# valid name
valid.arg.index(ll,"e")# non-existing name
valid.arg.index(ll,5,safe=FALSE) # still return the index
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.