I'm trying to create a correlation matrix for showing correlations among the average store sales for all product categories. The Product Categories are columns 10-18.
Here is my head(df2):
> head(df2)
store city region province size revenue units cost gross_profit promo_units energy_units regularBars_units
1 105 BROCKVILLE ONTARIO ON 496 984.70 470.46 590.73 393.97 210.23 72.13 38.63
2 117 BURLINGTON ONTARIO ON 875 2629.32 1131.38 1621.58 1007.74 401.46 192.77 75.04
3 122 BURLINGTON ONTARIO ON 691 2786.73 1229.46 1709.45 1077.27 450.04 240.48 93.73
4 123 BURLINGTON ONTARIO ON 763 2834.49 1257.63 1719.61 1114.88 476.83 194.21 99.44
5 182 DON MILLS ONTARIO ON 784 4118.36 1949.50 2485.83 1632.53 664.71 199.73 175.48
7 186 NORTH YORK ONTARIO ON 966 8195.26 3695.46 5069.99 3125.27 1143.33 419.19 271.58
gum_units bagpegCandy_units isotonics_units singleServePotato_units takeHomePotato_units kingBars_units flatWater_units
1 29.29 13.38 20.69 18.60 7.71 17.87 56.54
2 55.85 42.15 87.62 36.44 33.46 47.44 98.42
3 64.27 29.85 105.65 47.96 19.90 45.21 130.27
4 73.25 54.15 118.19 39.67 22.10 45.33 132.77
5 145.81 68.06 109.35 85.71 42.33 79.81 204.06
7 212.42 153.90 166.37 130.79 136.79 114.50 328.63
psd591Ml_units
1 39.71
2 38.73
3 47.31
4 39.87
5 50.29
7 112.38
Here is my dput(df2):
> dput(head(df2,4))
structure(list(store = c(105L, 117L, 122L, 123L), city = c("BROCKVILLE",
"BURLINGTON", "BURLINGTON", "BURLINGTON"), region = c("ONTARIO",
"ONTARIO", "ONTARIO", "ONTARIO"), province = c("ON", "ON", "ON",
"ON"), size = c(496L, 875L, 691L, 763L), revenue = c(984.7, 2629.32,
2786.73, 2834.49), units = c(470.46, 1131.38, 1229.46, 1257.63
), cost = c(590.73, 1621.58, 1709.45, 1719.61), gross_profit = c(393.97,
1007.74, 1077.27, 1114.88), promo_units = c(210.23, 401.46, 450.04,
476.83), energy_units = c(72.13, 192.77, 240.48, 194.21), regularBars_units = c(38.63,
75.04, 93.73, 99.44), gum_units = c(29.29, 55.85, 64.27, 73.25
), bagpegCandy_units = c(13.38, 42.15, 29.85, 54.15), isotonics_units = c(20.69,
87.62, 105.65, 118.19), singleServePotato_units = c(18.6, 36.44,
47.96, 39.67), takeHomePotato_units = c(7.71, 33.46, 19.9, 22.1
), kingBars_units = c(17.87, 47.44, 45.21, 45.33), flatWater_units = c(56.54,
98.42, 130.27, 132.77), psd591Ml_units = c(39.71, 38.73, 47.31,
39.87)), na.action = structure(c(`6` = 6L, `169` = 169L, `173` = 173L,
`177` = 177L, `182` = 182L, `191` = 191L, `193` = 193L, `195` = 195L,
`196` = 196L, `198` = 198L, `204` = 204L, `277` = 277L, `385` = 385L,
`452` = 452L, `527` = 527L, `601` = 601L), class = "omit"), row.names = c(NA,
4L), class = "data.frame")