Description Usage Arguments Details Value Examples
An index is implied if a character vector contains the '['. If x
contains both 'w' and 'w[1]' as elements, will return only 'w[1]'. Purpose is for avoiding redundancy when an object name can stand as a shortcut for an object and all of its indices. Care is to be taken, though, because if 'w' is length 2, 'w[2]' would be omitted in the above example, even though by specifying 'w' one may have intended to imply 'w[2]'.
1 |
x |
A character vector |
This function may behave strangely if x
contains the '[' character that does not refer to an index, or is not followed by ']', which together surround regular R-style indexing syntax. See Examples.
If x
has positive length, returns a character vector of at least length 1 , but no longer than length(x)
1 2 3 4 5 6 7 8 9 10 11 | # Typical/ intended use
ifInd_strip_noInd(c("theta","w","w[1]"))
# Odd use
# Note that the last element is valid R syntax
# Yet Z is not removed
ifInd_strip_noInd(c("Z", "Z[", "do.call('[', list(Z,1))"))
# However, if normal and odd indexing exists,
# only the standard "Z" is stripped out
ifInd_strip_noInd(c("Z", "Z[1]", "Z[", "do.call('[', list(Z,1))"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.