seq_events {linbin} | R Documentation |
Generate Sequential Events
Description
Generates groups of regularly sequenced events fitted to the specified intervals. Intended for use as bins with sample_events
.
Usage
seq_events(coverage, length.out = NULL, by = NULL, adaptive = FALSE)
Arguments
coverage |
An event table specifying the non-overlapping intervals to which the event sequences will be fitted. Gaps in coverage do not count towards event length. Points in the coverage are currently ignored. |
length.out |
The number of events in each sequence. Event lengths are chosen such that they evenly divide the |
by |
The length of the events in each sequence. Ignored if |
adaptive |
If |
Value
An endpoint-only event table with an additional group field if the length of length.out
or by
is >
1.
See Also
event_range
, event_coverage
, and fill_event_gaps
for building a coverage
from an existing event table.
Examples
e <- events(c(0, 20, 40), c(10, 30, 45))
no.gaps <- event_range(e)
has.gaps <- event_coverage(e)
seq_events(no.gaps, by = 10) # unequal length (last is shorter)
seq_events(no.gaps, by = 10, adaptive = TRUE) # equal length (11.25)
seq_events(no.gaps, length.out = 4) # equal length (11.25)
seq_events(has.gaps, length.out = 4, adaptive = FALSE) # equal coverage (11.25), straddling gaps
seq_events(has.gaps, length.out = 4, adaptive = TRUE) # unequal coverage, fitted to gaps
seq_events(no.gaps, length.out = c(2, 4)) # "group" column added