I am trying to explore the possibility of integrating Tableau with R and implementing a decision tree (to begin with, would like to extend it to a random forest later).
I have attached my worksheet. I give a small description of what I want to achieve here.
For all customers labelled as 'Frequent', I have the number of transactions they made in last 13 weeks and their average spending per transaction. I calculated the average transactions per customer to be around 4 transactions in this time period. Now I want to make a decision tree that for all 'Frequent' customers, split them in one branch if they have more than the average transactions (4) and if not then into another branch. How to do this? Can someone help me with a script to begin with?