'How to find patterns in a dataset with apriori() function of the arules library in R?
I have a dataset that looks like this:
| reportid | type | name | value |
|---|---|---|---|
| 1 | C | asthma | 0 |
| 1 | S | shortness of breath | 0 |
| 1 | T | bronchodilators | twice a day |
| 2 | S | headhache | everyday |
| 2 | T | paracetamol | every 6 hours |
| 3 | S | stress | 0 |
| 3 | N | sleep | 4 hours |
| 3 | T | sleep | 8 hours |
Where C is Condition, S is Symptom, T is Treatment, N is Note. The same thing (like sleep) can be a symptom or a treatment, for example. I'm trying to do Association Rule Mining to figure out what are the most common treatment for certain symptoms, what are the conditions most associated with headaches or whatnot. I'm using the apriori() function of the arules library in R but I'm having a hard time. I can get the most common symptoms, the most common treatments, but i cannot figure out how to associate them. I tried grouping by the reportid but it became difficult to access the other stuff. The dataset has almost one million rows and 7 columns (the other ones are not important right now, date, user). Any ideas?
Thank you so much in advance.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
