0

I am trying to filter rules which contain a certain category of item in the LHS , stored the items belonging to that category in the form of a vector and using this vector with subset to filter all the rules.

The error I am getting is "table contains an unknown item label".

Here's a snapshot of the code below:

top500vec is the vector which contains all the items of the same category ,interested at looking for rules with these items on the LHS side

enter image description here

Phil
  • 7,287
  • 3
  • 36
  • 66
  • Hi Jared, could you provide a sample of your data to make your question reproducible? This will increase the chance and speed to get a helpful answer. (see: https://stackoverflow.com/questions/5963269) – Marcelo Avila Mar 23 '21 at 22:50

1 Answers1

0

BY just looking at the error, it seems like top500vec contains item labels that are not defined in top500onlyrules. Check itemLabels(top500onlyrules) and make sure that top500vec only contains values that are valid item labels.

You should always post questions with reproducible examples. See: How to make a great R reproducible example

Michael Hahsler
  • 2,965
  • 1
  • 12
  • 16
  • I want the function to ignore labels that do not match in top500vec and top500onlyrules. – Jared Max Mar 25 '21 at 05:43
  • You need to remove these labels from top500vec first. You can probably do something like `filter_items <- intersect(as.character(top500vec), itemLabels(top500onlyrules))`. – Michael Hahsler Mar 26 '21 at 14:03