arules

R - arules apriori Error in length(obj) : Method length not implemented for class rules

有些话、适合烂在心里 提交于 2019-12-07 08:17:17
问题 I am attempting to make an association rules set using apriori - I am using a different dataset but the starwars dataset contains similar issues. Using arules I was attempting to list the rules and apply an arulesViz plot. From my understanding all strings must be ran as factors, listed as transactions and then apriori should be functioning properly but I get the ouput below after running the following code and rules is not added to environment: install.packages("arules") install.packages(

Transform csv into transactions for arules [duplicate]

本秂侑毒 提交于 2019-12-06 15:41:28
This question already has answers here : How to prep transaction data into basket for arules (2 answers) Closed 3 years ago . I have a subset from a database in csv which has several different columns and I would like to convert the data into transactions. I've already read this post library(arules) library(arulesViz) trans = read.transactions("data.csv", format = "single", sep = ",", cols = c("EMAIL", "BRAND")) However wasn't able to convert my data with the proposed solution: CATEGORY BRAND SKU EMAIL SEGMENT SALES shorts gap 1564 one@mail.x 1 1 tops gap 8974 one@mail.x 1 2 shoes nike 3245

R arulesSequences Find which patterns are supported by a sequence

情到浓时终转凉″ 提交于 2019-12-06 05:02:26
I'm having troubles with the arulesSequences library in R I have a transactional dataset with temporal information (here, let's use the default zaki dataset). I use SPADE ( cspade function) to find the frequent subsequences in the dataset. library(arulesSequences) data(zaki) frequent_sequences <- cspade(zaki, parameter=list(support=0.5)) Now, what I want is to find, for each sequence (i.e. for each custumer) which are the frequent subsequences that it supports. I tried various combinations of %in% and subset without much success. For example for the second custumer, the initial transactions

R arulesSequences - which frequent sequences are present in a transaction?

旧街凉风 提交于 2019-12-05 01:34:50
问题 When doing frequent sequence mining, one typically wants to the following tasks: 1. Find sequential patterns (frequent sequences). 2. Find out which sequential patterns apply to a transaction. I.e.: given a transaction, which of all of the frequent sequences found is present? I'am having trouble doing the latter. Using R, I am applying the cspade-algorithm from the arulesSequences package on the following toy dataset: data <- data.frame(id = 1:10, transaction = c("A B B A", "A B C B D C B B B

R arules - subset of transactions that match a rule

谁说我不能喝 提交于 2019-12-04 12:51:11
I'm using the R package arules . I have some transactions and a rule (see below). I want the subset of transactions that break the rule. How can I do that? This is the set up: library(arules) data(Adult) summary(Adult) rules = apriori(Adult,parameter=list(support=0.2,confidence=0.8)) summary(rules) r=rules[1] I want the subset of transactions that contain the left hand side of the rule r but not the right hand side. The arules documentation doesn't have an example like this. I've tried %in% , match and subset but I can't get the syntax right. The documentation for the subset function has an

Writing rules generated by Apriori

谁都会走 提交于 2019-12-04 09:12:20
问题 I'm working with some large transactions data. I've been using read.transactions and apriori (parts of the arules package) to mine for frequent item pairings. My problem is this: when rules are generated (using "inspect()") I can easily view them in the R console. Right now I'm manually copying the results into a text file, then saving and opening in excel. I'd like to just save the generated rules using write.csv, or something similar, but when I try, I receive an error that the data cannot

R arulesSequences - which frequent sequences are present in a transaction?

寵の児 提交于 2019-12-03 16:50:52
When doing frequent sequence mining, one typically wants to the following tasks: 1. Find sequential patterns (frequent sequences). 2. Find out which sequential patterns apply to a transaction. I.e.: given a transaction, which of all of the frequent sequences found is present? I'am having trouble doing the latter. Using R, I am applying the cspade-algorithm from the arulesSequences package on the following toy dataset: data <- data.frame(id = 1:10, transaction = c("A B B A", "A B C B D C B B B F A", "A A B", "B A B A", "A B B B B", "A A A B", "A B B A B B", "E F F A C B D A B C D E", "A B B A B

Writing rules generated by Apriori

让人想犯罪 __ 提交于 2019-12-03 02:06:32
I'm working with some large transactions data. I've been using read.transactions and apriori (parts of the arules package) to mine for frequent item pairings. My problem is this: when rules are generated (using "inspect()") I can easily view them in the R console. Right now I'm manually copying the results into a text file, then saving and opening in excel. I'd like to just save the generated rules using write.csv, or something similar, but when I try, I receive an error that the data cannot be coerced into data.frame. Does anyone have experience doing this successfully in R? I know I'm

R Basket Analysis using arules package with unique order number but duplicate order combinations

可紊 提交于 2019-12-03 00:35:24
R Basket analysis using arules package with unique order number but duplicate order combinations Just learning R. I'm trying to do a basket analysis using the arules package (but I'm totally open to any other package suggestions!) to compare all possible combinations of 6 different item types being purchased. My original data set looked like this: OrderNo, ItemType, ItemCount 111, Health, 1 111, Leisure, 2 111, Sports, 1 222, Health, 3 333, Food, 7 333, Clothing, 1 444, Clothing, 2 444, Health, 1 444, Accessories, 2 . . . the list goes on and has about 3,000 observations. I collapsed the data

Load a dataset into R with data() using a variable instead of the dataset name

99封情书 提交于 2019-11-30 18:12:03
I am trying to load a dataset into R using the data() function. It works fine when I use the dataset name (e.g. data(Titanic) or data("Titanic") ). What doesn't work for me is loading a dataset using a variable instead of its name. For example: # This works fine: > data(Titanic) # This works fine as well: > data("Titanic") # This doesn't work: > myvar <- Titanic > data(myvar) **Warning message: In data(myvar) : data set ‘myvar’ not found** Why is R looking for a dataset named "myvar" since it is not quoted? And since this is the default behavior, isn't there a way to load a dataset stored in a