If I have data (a data frame) like
Type Value Date
A 1.1 1/1/2018
B 1.0 1/1/2018
C 9.9 1/1/2018
A 0.9 3/3/2018
B 1.0 3/3/2018
C 9.9 3/3/2018
How do I put the data into the form
Date A B C
1/1/2018 1.1 1.0 9.9
3/1/2018 0.9 1.0 9.9
As for why I would want to do this, it's because for each Date I want to compute the values B-A and C-A...if there's a way to do that more directly, that would be great too.
Thank you.
Edit to add minimal example:
Type = c("A","B","C","A","B","C")
Value = c(1.1, 1.0, 9.9, 0.9, 1.0, 9.9)
Date = c("1/1/2018", "1/1/2018", "1/1/2018", "3/3/2018","3/3/2018", "3/3/2018")
df = data.frame(Type, Value, Date)