October 2017
Beginner to intermediate
572 pages
26h 1m
English
Perform the following steps to transform different formats of data into transactions:
> install.packages("arules")
> library(arules)
> tr_list = list(c("Apple", "Bread", "Cake"),
+ c("Apple", "Bread", "Milk"),
+ c("Bread", "Cake", "Milk"))
> names(tr_list) = paste("Tr",c(1:3), sep = "")
> trans = as(tr_list, "transactions")
> trans
Output
transactions in sparse format with
3 transactions (rows) and
4 items (columns)
> tr_matrix = matrix( + c(1,1,1,0, ...
Read now
Unlock full access