Recreate patterns for collapsed arrays
A vector to be repeated.
Which indices of the implicit array are given in
Dimensions of implicit array.
logical indicating whether to check vailidty of arguments, but therefore slow things down.
logical indicating whether to respect the ordering of the
entries in the vector
These functions allow for the construction of complex repeating patterns
corresponding to those obtained by unwrapping arrays. Consider an array
n; then for each value of the dimensions in
which, this function returns a vector which places the corresponding
x into every place which would match this pattern when the
full array is unwrapped.
For example, if a full 4-way array has dimensions 2*2*2*2 and we consider the margin of variables 2 and 4, then the function returns the pattern c(1,1,2,2,1,1,2,2,3,3,4,4,3,3,4,4). The entries 1,2,3,4 correspond to the patterns (0,0), (1,0), (0,1) and (1,1) for the 2nd and 4th indices.
patternRepeat() the argument
x is repeated according to the
patternRepeat0() just returns the indexing pattern.
patternRepeat(x,which,n) is effectively equivalent to
The length of
x must be equal to
Both return a vector of length
patternRepeat() one containing suitably repeated and ordered elements
patternRepeat0() it is always the integers from 1 up
1 2 3 4 5 6 7 8 9 10
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.