Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7085641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:26:58+00:00 2026-05-28T07:26:58+00:00

Problem: The apriori function of the arules package infers association rules from the input

  • 0

Problem:

The apriori function of the arules package infers association rules from the input transactions and reports the support, confidence, and lift of each rule. The association rules are derived from frequent itemsets. I’d like to get the most frequent itemsets in the input transactions. Specifically, I’d like to get all itemsets with a given minimum support. The support of an itemset is the ratio of the number of the transactions that contain the itemset to the total number of transactions.

Requirements:

  1. I’d strongly prefer to find the most frequent itemsets from the intermediate results of the apriori function. That is, I’d rather not to write a program from scratch just to compute the most frequent itemsets, because the apriori function already computes it as an intermediate step. Nonetheless, if there is really not a reasonable way of accessing the intermediate results of the apriori function, I’m open to other solutions.
  2. I’d rather not to do string manipulation on the result of the apriori function because this approach will be too dependent on the string representation of the result of the apriori function. Again, if it turns out that there are no better alternatives, I may resort to this approach.
  3. I’m aware of the itemFrequency function provided by the arules package. Unfortunately, this function just reports the itemsets with a single item. I’m interested in all itemsets of any length with a minimum support.
  4. I’d like the output to be sorted by support numerically and then by itemset lexicographically.

Example Input:

a,b
a,b,c

Program:

# The following is how I'm using apriori to infer the association rules.
library(package = "arules")
transactions = read.transactions(file = file("stdin"), format = "basket", sep = ",")
rules = apriori(transactions, parameter = list(minlen=1, sup = 0.001, conf = 0.001))
WRITE(rules, file = "", sep = ",", quote = TRUE, col.names = NA)

Current Output:

"","rules","support","confidence","lift"
"1","{} => {c}",0.5,0.5,1
"2","{} => {b}",1,1,1
"3","{} => {a}",1,1,1
"4","{c} => {b}",0.5,1,1
"5","{b} => {c}",0.5,0.5,1
"6","{c} => {a}",0.5,1,1
"7","{a} => {c}",0.5,0.5,1
"8","{b} => {a}",1,1,1
"9","{a} => {b}",1,1,1
"10","{b,c} => {a}",0.5,1,1
"11","{a,c} => {b}",0.5,1,1
"12","{a,b} => {c}",0.5,0.5,1

Desired Output:

"itemset","support"
"{a}",1
"{a,b}",1
"{b}",1
"{a,b,c}",0.5
"{a,c}",0.5
"{b,c}",0.5
"{c}",0.5
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T07:26:59+00:00Added an answer on May 28, 2026 at 7:26 am

    I found the generatingItemsets function in the reference manual of the arules package.

    library(package = "arules")
    transactions = read.transactions(file = file("stdin"), format = "basket", sep = ",")
    rules = apriori(transactions, parameter = list(minlen=1, sup = 0.001, conf = 0.001))
    itemsets <- unique(generatingItemsets(rules))
    itemsets.df <- as(itemsets, "data.frame")
    frequentItemsets <- itemsets.df[with(itemsets.df, order(-support,items)),]
    names(frequentItemsets)[1] <- "itemset"
    write.table(frequentItemsets, file = "", sep = ",", row.names = FALSE)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Problem in short: How to call a function from DLL A.dll using p/invoke when
Problem: I have an address field from an Access database which has been converted
Problem: Given a list of strings, find the substring which, if subtracted from the
Problem: We have a web app that calls some web services asynchronously (from the
Problem I have a Silverlight 5 application using the treeview from the SDK. Now
Problem: I need to retrieve the language of a given cell from the cube.
Problem description is here : http://www.spoj.pl/problems/FASHION/ Process : Took two lists as input ,
Problem Why would compiling a program which has an int main(void) main function differ
Problem. I regularly receive a feed files from different suppliers. Although the column names
Problem: We have to read from a proprietary binary file at work. It changes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.