check_repetition checks whether the series have identical or near-identical repetition larger than lmin. if that is the case, throw an error, the algorithm cannot yet handle these repetition, because variance on the segment would be null.

check_repetition(x, lmin, rounding = FALSE, magnitude = 3)

Arguments

x

the bivariate series to be tested

lmin

minimum length of segment

rounding

whether or not series are rounded

magnitude

number of magnitude of standard deviation below which values are rounded. i.e if magnitude = 3, difference smaller than one thousandth of the standard deviation are rounded to the same value.

Value

a boolean, TRUE if there is any repetition larger or equal to lmin.

Examples

set.seed(42) 
dat <- rbind(base::sample(seq(1,10),  size= 100, replace = TRUE),
             base::sample(seq(1,10),  size= 100, replace = TRUE))
check_repetition(dat, lmin = 3)
#> [1] TRUE
check_repetition(dat, lmin = 5)             
#> [1] FALSE