Qaiser iqbal
Qaiser iqbal

Reputation: 306

R Apriori algorithm - how to assign top items values of ItemsFrequency() function to a vector?

Hello i am working in Rpriori. In this algorithum we use itemFrequency() function which return top items from data.Now i want to get the value of top items. not a labels. and assign it to a vector.Thanks in advance

Remember:name argument give the name of the top items.only need has value!!!!!

Upvotes: 1

Views: 55

Answers (1)

Tajdar Khan Afridi
Tajdar Khan Afridi

Reputation: 400

It will return the numeric vector containing names and values.

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

But if you want only the value then try something like this

print(items[["whole milk"]])
Output: 2513

Upvotes: 1

Related Questions