help to Prepare data for Correlation analysis

so I have a data.frame that is setup like so, with about 2000 rows.

It's basically some Sales data for different Brands by Customer, and there is about 30 Distinct Brands, with various different spends by different customers. Brands do repeat with different customers.

The analysis that I want to do is, to do a correlation matrix of these 30 Brands, so see if there is a customer affinity between some Brands or high correlations between Brands, etc..

This is just trying to learn, I know how to run a lot of the R code for correlation, and there is plenty of examples on the internet, I am just not sure how to prepare the data set so that I can do the correlations and also matrix ready that I can also do some chart correlation graphics, etc...

What is the best way to transform this dataset to get it ready for correlation analysis ?

I would appreciate some code R examples for this part, thank you!

ID, BRAND, SPEND
123, X123, 1500
435, X654, 750
234, Y111, 100
444, X123, 25

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.