Description Usage Arguments Value Author(s) See Also Examples

View source: R/untie.R View source: R/AllGeneric.R

This is a generic function intended to randomly break tied data in a
way similar to what `jitter`

does: tie-breaking is
performed by shifting *all* data points by a random amount.
The surveillance package defines methods for matrices,
`"epidataCS"`

, and a default method for numeric vectors.

1 2 3 4 5 6 7 8 9 10 11 12 13 | ```
untie(x, amount, ...)
## S3 method for class 'epidataCS'
untie(x, amount = list(t=NULL, s=NULL),
minsep = list(t=0, s=0), direction = "left", keep.sources = FALSE,
..., verbose = FALSE)
## S3 method for class 'matrix'
untie(x, amount = NULL, minsep = 0,
constraint = NULL, giveup = 1000, ...)
## Default S3 method:
untie(x, amount = NULL, minsep = 0,
direction = c("symmetric", "left", "right"), sort = NULL,
giveup = 1000, ...)
``` |

`x` |
the data to be untied. |

`amount` |
upper bound for the random amount by which data are shifted.
For numeric vectors (default method), the jittered version is the
same as for |

`minsep` |
minimum separation of jittered points. Can only be
obeyed if much smaller than |

`keep.sources` |
logical ( |

`constraint` |
an object of class |

`giveup` |
number of attempts after which the algorithm should stop trying to generate new points. |

`direction` |
one of |

`sort` |
logical indicating if the jittered vector should be sorted. Defaults to doing so if the original vector was already sorted. |

`...` |
For the |

`verbose` |
logical passed to |

the untied (jittered) data.

Sebastian Meyer

1 2 3 4 5 6 7 8 9 10 11 12 13 | ```
# vector example
set.seed(123)
untie(c(rep(1,3), rep(1.2, 4), rep(3,3)), direction="left", sort=FALSE)
# spatial example
data(imdepi)
coords <- coordinates(imdepi$events)
table(duplicated(coords))
plot(coords, cex=sqrt(multiplicity(coords)))
set.seed(1)
coords_untied <- untie(coords)
stopifnot(!anyDuplicated(coords_untied))
points(coords_untied, col=2) # shifted by very small amount in this case
``` |

surveillance documentation built on Jan. 30, 2018, 3 p.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.