Qaiser iqbal
Qaiser iqbal

Reputation: 306

R apriori algorithm-How to assign top items of ItemFrequency() to a vector?

I am working in R apriori algorithm which have a function ItemFrequencyPlot() of arules library.

This function create a plot by passing argument (topN).Here we pass (Top N =20) which plot the top 20 items.Basically the function find top items on the basis of frequency.The function returns plot image which have top items.

Now My Question is that who assigns these top items to a vector or how we get these top items in order to perform additional operation.enter image description here

Upvotes: 3

Views: 1328

Answers (1)

sebastianmm
sebastianmm

Reputation: 1176

If you want to get the most frequent items, you can use the function itemFrequency. To get the absolute count of the 20 most frequent items, try

itms <- itemFrequency(myTransactions, type = "absolute")
head(sort(itms, decreasing = TRUE), n = 20)

Upvotes: 3

Related Questions