An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130309/3285186e/attachment.pl>
grouping followed by finding frequent patterns in R
2 messages · Dhiman Biswas, Bert Gunter
I **suggest** that you explain what you wish to accomplish using a reproducible example rather than telling us what packages you think you should use. I believe you are making things too complicated; e.g. what do you mean by "frequent patterns"? Moreover, "basket format" is rather unclear -- and may well be unnecessary. But using lists, it could be simply accomplished by ?split ## as in the_list <- with(yourdata, split(TYP, CIN.TRN)) or possibly the_list <- with(yourdata, tapply(TYP,CIN.TRN, FUN = table)) Of course, these may be irrelevant and useless, but without knowing your purpose ...? -- Bert
On Sat, Mar 9, 2013 at 4:37 AM, Dhiman Biswas <crazydhimu at gmail.com> wrote:
I have a data in the following form :
CIN TRN_TYP
9079954 1
9079954 2
9079954 3
9079954 4
9079954 5
9079954 4
9079954 5
9079954 6
9079954 7
9079954 8
9079954 9
9079954 9
. .
. .
. .
there are 100 types of CIN (9079954,12441087,15246633,...) and respective
TRN_TYP
first of all, I want this data to be grouped into basket format:
9079954 1, 2, 3, 4, 5, ....
12441087 19, 14, 21, 3, 7, ...
.
.
.
and then apply eclat from arules package to find frequent patterns.
1) I ran the following code:
file<-read.csv("D:/R/Practice/Data_Input_NUM.csv")
file <- file[!duplicated(file),]
eclat(split(file$TRN_TYP,file$CIN))
but it gave me the following error:
Error in asMethod(object) : can not coerce list with transactions with
duplicated items
2) I ran this code:
file<-read.csv("D:/R/Practice/Data_Input_NUM.csv")
file_new<-file[,c(3,6)] # because my file Data_Input_NUM has many other
columns as well, so I selecting only CIN and TRN_TYP
file_new <- file_new[!duplicated(file_new),]
eclat(split(file_new$TRN_TYP,file_new$CIN))
but again:
Error in eclat(split(file_new$TRN_TYP, file_new$CIN)) :
internal error in trio library
PLEASE HELP
[[alternative HTML version deleted]]
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Bert Gunter Genentech Nonclinical Biostatistics Internal Contact Info: Phone: 467-7374 Website: http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm