This problem confused me for a while and I'll try to describe as clearly as possible:
I would like to calculate correlations of sales between each pair of hotels, and here is my data:
hotel = c("A","A","B","C","C","D")
Staydate = c(1:6)
cbind(hotel, Staydate, sales)
Each hotel might have multiple sales because the staydate is different. I would like to create a matrix calculating the correlation between hotels.
Shall I break the data.frame down to each hotel first? Or is there any method I can aggregate by hotel first, then calculate correlation?
My expected results would be the correlations between each pair of hotels. A matrix visualization would be very helpful! For example, in the following image, change sepal length, sepal width, petal length, and petal width into hotel A, B, C, D.
Thanks!!