Description Usage Arguments Value Examples
This function uses run length encoding to determine the middle of every group of repeated values within a larger vector.
1 | middle.group(vec, type = "tf")
|
vec |
Any vector which you want to know the middle of. |
type |
Either "tf" to return a boolean or "loc" to return a set of numerical locations. |
If type=="tf": Boolean of length length(vec) containing TRUE if the middle of a grouping and FALSE if not. If type=="loc": Vector of length equal to the number of groups in vec, containing locations of the group centers. Ties (for groups of even length) are broken by rounding up.
1 2 3 | test <- c(1,2,2,2,2,2,2,2,2,2,1)
middle.group(test)
middle.group(test,type="loc")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.