read_transactions reads transaction data from a file fast, providing a significant speed increase over alternative methods for larger files.
read_transactions(filename, sep =" ", format ="list")
Arguments
filename: A filename.
sep: The separator between items (default " ").
format: The output format ("list" or "transactions").
Returns
The transaction data, in the form of a list (of transactions, each list element being a vector of character values representing item labels), or an object of class transactions (arules).
Details
read_transactions uses (internally) the readChar
function to read transaction data from a file fast. This is substantially faster for larger files than alternative methods.
Files should be in the format of a list of transactions, one line per transaction, each transaction (ie, line) being a sequence of item labels, separated by the character specified by the parameter sep (default " "). See, for example, the files at http://fimi.ua.ac.be/data/.
Examples
## Not run:trans <- read_transactions("mushroom.dat")trans <- read_transactions("mushroom.dat", format ="transactions")## End(Not run)