Reads a file in table format and attempts to coerce it to an event table.
read_events(file, from.col = 1, to.col = 2, sep = "", header = TRUE, ...)
Name, connection
, or url
of the file to be read as an event table.
Names or indices of the columns containing event endpoints. Values are swapped as needed to ensure that to > or = from
on all rows.
Character separating values on each line of the file. If sep = ""
(the default), the separator is 'white space' (that is, any combination of one or more spaces, tabs, newlines and carriage returns).
Logical value indicating whether the file contains column names as its first line. If FALSE
, columns will be named "V" followed by the column number, unless col.names
(a vector of optional column names) is provided as an additional argument.
Additional arguments, of the form tag = value
, to be passed directly to read.table
to control how the file is read.
The file is read into R by calling read.table
. Any of its arguments can be set by passing additional tag = value
pairs. from.col
and to.col
are renamed to "from" and "to" as needed. Since these column names must be unique, other columns cannot also be called "from" or "to".
events
and as_events
for creating event tables from existing objects.