View source: R/event_creation.R
as_events | R Documentation |
Attempts to coerce an object to an event table.
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, ...)
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 |
numeric
: Expands a numeric vector into two columns of event endpoints.
POSIXt
: Coerces to numeric before dispatching.
Date
: Coerces to numeric before dispatching.
matrix
: Converts the matrix to a data frame, then calls the data.frame
method.
data.frame
: Renames from.col
and to.col
to "from" and "to" as needed. Since these column names must be unique, other columns cannot also be called "from" or "to".
events
for creating event tables and read_events
for reading files as event tables.
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.