I am quite new to coding in R, and im working on cleaning and transforming some data.
I have looked at some different uses of reshape() and reshape2() for the cast function to help me, but i have not been able to succeed.
Basically what i would like to do is, to move one column up as column headers for the values.
This is my data:
#My data:
KEYFIGURE LOCID PRDID KEYFIGUREDATE KEYFIGUREVALUE
Sales 1001 A 2018-01-01 1
Promo 1001 A 2018-01-02 2
Disc 1001 A 2018-01-03 3
Sales 1001 B 2018-01-01 10
Promo 1001 B 2018-01-01 11
Disc 1002 B 2018-01-03 12
The result i would like to get:
LOCID PRDID KEYFIGUREDATE Sales Promo Disc
1001 A 2018-01-01 1 2
1001 A 2018-01-03 3
1001 B 2018-01-01 10 11
1002 B 2018-01-03 12
However, i am having quite some trouble figuring out how this is possibly in a smart way w. reshape package.