seamless | R Documentation |
is_seamless
checks if a given history (i.e. a succession of intervals) is
seamless, i.e. stop timepoints of preceding coincide with start timepoints of
succeeding intervals. Conversion of a not seamless into a seamless history can be attempted with
seamless
.
is_seamless(d, begin = begin, end = end)
seamless(d, begin = begin, end = end)
d |
table |
begin |
|
end |
|
is_seamless
returns a logical stating whether history is seamless or not
seamless
returns a tibble
that is seamless, i.e. satisfies is_seamless
# set seed to make it reproducible
set.seed(3)
# generate random numbers between 0 and 1e6
rn <- runif(5, 0, 1e6)
# generate intervals in seconds
ir <- rn + runif(5, 0, 1e6)
# generate random history `hx` (table)
hx <- data.frame(unit = sample(letters[1:3], 5, TRUE),
begin = as.POSIXlt(rn, origin = "2021-01-01 00:00:00"),
end = as.POSIXlt(ir, origin = "2021-01-01 00:00:00"))
# hx is expected to not be seamless
is_seamless(hx) # returns FALSE
# hx can, however, be converted
## Not run:
sl_hx <- seamless(hx)
is_seamless(sl_hx) # returns TRUE
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.