events: Event Tables

View source: R/event_creation.R

eventsR Documentation

Event Tables

Description

Creates an event table, a custom data.frame used throughout the linbin package to store and manipulate linearly referenced data. Each row includes an event's endpoints from and to (which can be equal, to describe a point, or non-equal, to describe a line) and the values of any variables measured on that interval.

Usage

events(from = numeric(), to = NULL, ...)

Arguments

from, to

Event endpoints, in any format coercible to single data frame columns. from and to are swapped as needed so that to > or = from on all rows. If from is the only non-empty argument, as_events is dispatched for object coercion.

...

Additional arguments, either of the form value or tag = value, to be passed directly to data.frame following from and to. Component names are created based on the tag (if present) or the deparsed argument itself.

Details

Event endpoints (and any additional arguments) are coerced to a data frame with data.frame, then coerced to an event table with as_events. A valid event table has two columns named "from" and "to" containing only finite numeric values (i.e., no NA, NaN, or Inf) and ordered such that to > or = from. is_events tests for these requirements. The other columns in the event table can be of any type supported by the data.frame class.

Value

An event table, the data.frame object used by linbin to describe interval data.

See Also

data.frame.

as_events and read_events for coercing objects and files to event tables, is_events to validate event tables.

Examples

events(1, 5)
events(1:5)
events(c(0, 15, 25), c(10, 30, 35), x = 1, y = c('a', 'b', 'c'))

ezwelty/linbin documentation built on April 19, 2023, 8:41 a.m.