Hi Experts here. I am trying to transpose the column names and add calculated values. Is there a way to achieve this. For example
df
Date ColA ColB ColC
27/8/2019 5 6 10
28/8/2019 4 6 10
29/8/2019 1 2 10
Required output below. Actually the values should be 1.4 instead of 14/10. Just to make the user understand I have put the ratios. Is there a way to achieve this
ColA ColB ColC
ColA 1 10/14 10/30
ColB 14/10 1 14/30
ColC 30/10 30/14 1
The values above are means of respective Columns. For example mean of ColA is 10, mean of ColB is 14 and mean of ColC is 30
Dput below
df <- structure(list(Date = structure(1:3, .Label = c("27/8/2019",
"28/8/2019", "29/8/2019"), class = "factor"), ColA = c(5, 4,
1), ColB = c(6, 6, 2), ColC = c(10, 10, 10)), class = "data.frame", row.names = c(NA,
-3L))