data format error in association rule learning R -
i tried search other posts in r related this, did not find duplicated questions(at least efforts). know need priori function in library("a rules") though.
i have large array file each row list
user1: [1,2,3,4] # [1,2,3,4] itemlist purchased user user2: [4] ................
i want find items tend purchased together. how should proceed? seems need convert data "transaction" format file also.
so did
temp <- split(a, 1:nrow(a)) # temp list of lists b <- as(temp, "transactions")
but got error "error in asmethod(object) : can coerce list atomic components only" can help?
i googled example , run following code without problem
a_list <- list(c("i1","i2","i5"), c("i2","i4"), c("i2","i3"), c("i1","i2","i4"), c("i1","i3"),c("i2","i3"),c("i1","i3"), c("i1","i2","i3","i5"), c("i1","i2","i3") ) names(a_list) <- paste("t",c(1:9), "00", sep = "") table5_1 <- as(a_list, "transactions")
both of temp (in code) , a_list of class list, however
a_list[1] [[1]] [1] "i1" "i2" "i5" temp[1] $`1` $`1`$`1` [1] 1,2,3,4
how should correct this? due factor temp file derived data frame?
thanks
i had same error , couldn't figure out. finally, realized had null values coming through in description/item field. i'd check null/empty strings coming through might issue (assuming have removed duplicate records 1 transaction).
Comments
Post a Comment