I do not have any experience with the packages you are using, so I can only give you some general advice. The error is happening at
and the complaint is that the $ operator is not valid for atomic vectors. That tells us that
is not returning a list as expected by the code. I would first run
tmp <- labels(lhs(rulesMatchLHS))
and inspect tmp with the str() and class() functions
I would then inspect rulesMatchLHS with the same functions. It should have the class rules. Maybe that will allow you to figure out what is wrong or you can report the results of those efforts here and someone might be able to provide more guidance.
I also am not familiar with these packages at all, but I wanted to chime in and offer both condolences and encouragement, as this is an error that I regularly find myself hitting and which you will probably see again. I think you are in good company, though, and not just of people new to R
Basically, somewhere a $ is getting fired on something or in a way that it shouldn't be. I usually end up debugging it by digging in more intentionally into the objects I am working with, simplifying my example, or breaking out "one liners" into more complete chunks.
i.e. in your case, I would take the rulesMatchLHS object, play with it, try t1 <- lhs(rulesMatchLHS), and maybe t2 <- labels(t1). Eventually, I'd get around to the $ and try to understand what is breaking where.
Not sure if it helps, but definitely don't give up! If I had a nickel for every time I got through this error... I'd have a lot of nickels. I think I saw it yesterday... You will do it!
(Aside: your github repo may make this possible, but digging into the skills of creating a reprex is probably one of the single most valuable skills you can develop as a learner! It helps you not only isolate your problem, but ask better questions that others can dig into. It is particularly helpful when you run into a bug in a package that you do not maintain or any hard-to-explain behavior)
I think that R Bike Input.csv and ItemsBasket.csv are interchanged in the code. Looking through https://github.com/oliviak/Recommender-in-Azure/tree/master/3%20Collaborative%20Filtering, the variable tr is supposed to contain 20745 transactions. Those can only come from R Bike Input.csv. Similarly, dataset1 is supposed to be a 1 x 2 matrix and that has to be ItemsBasket.csv. Try this version of the code. Note that I dropped the $element in the construction of the OutputClient data frame. The code still throws warnings, put it does produce a data frame that looks plausible to me.