read_baskets {arulesSequences} | R Documentation |
Read transaction data in basket format (with additional temporal
or other information) and create an object of class
transactions
.
read_baskets(con, sep = "[ \t]+", info = NULL, iteminfo = NULL)
con |
an object of class connection or file name. |
sep |
a regular expression specifying how fields are separated in the data file. |
info |
a character vector specifying the header for columns with additional transaction information. |
iteminfo |
a data frame specifying (additional) item information. |
Each line of text represents a transaction where items are
separated by a pattern matching the regular expression specified
by sep
.
Columns with additional information such as customer or time (event)
identifiers are required to come before any item identifiers and must
be specified by info
.
Sequential data are identified by the presence of the column identifiers
sequenceID
(sequence or customer identifier) and eventID
(time or event identifier) of slot transactionInfo
.
The row names of iteminfo
must match the item identifiers
present in the data. However, iteminfo
need not contain a
labels column.
An object of class transactions
.
Currently, it is not checked if column eventID
defines a
temporal order. sequenceID
and eventID
will be coerced
to factor if necessary.
For efficiency, the item labels are not sorted and, thus, are in the order they appear in the data.
Christian Buchta
Class
timedsequences
,
transactions
,
function
cspade
.
## read example data x <- read_baskets(con = system.file("misc", "zaki.txt", package = "arulesSequences"), info = c("sequenceID","eventID","SIZE")) as(x, "data.frame")