as_events: Coerce to an Event Table

Description Usage Arguments Methods (by class) See Also Examples

View source: R/event_creation.R

Description

Attempts to coerce an object to an event table.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
as_events(x, ...)

## S3 method for class 'numeric'
as_events(x, ...)

## S3 method for class 'POSIXt'
as_events(x, ...)

## S3 method for class 'Date'
as_events(x, ...)

## S3 method for class 'matrix'
as_events(x, from.col = 1, to.col = NULL, ...)

## S3 method for class 'data.frame'
as_events(x, from.col = 1, to.col = NULL, ...)

Arguments

x

Object to be coerced to an event table.

...

Additional arguments passed to or used by methods.

from.col, to.col

Names or indices of the columns in x containing the event endpoints. Values are swapped as needed to ensure that to > or = from on all rows. If NULL, to.col defaults to from.col + 1 (if column exists) or from.col.

Methods (by class)

See Also

events for creating event tables and read_events for reading files as event tables.

Examples

1
2
3
4
as_events(1)
as_events(1:5)
as_events(cbind(1:5, 1:5), 1, 2)
as_events(data.frame(x = 1, start = 1:5, stop = 1:5), "start", "stop")

linbin documentation built on April 20, 2021, 5:07 p.m.