subsetHelpers | R Documentation |
Functions that return x[i
] but with alternate behaviour when i is greater than the length of x.
loopSubset(x, i) overflowSubset(x, i)
x |
a vector to be subsetted. |
i |
a vector of indexes |
loopSubset will cycle back through the elements of x when i is too big. overflowSubset will simply give the last element of x instead.
A vector containing elements of x, chosen by the index i.
loopSubset(1:10,1:20) overflowSubset(1:10,1:20)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.