I have run into an unusual data set I need to reshape but the normal reshape/tidyr packages don’t appear to have a way to solve it. While reshaping the dataset with subsetting and rbind is possible, there has to be a more straightforward way to solve this issue.
The data set appears like this:
ID Item.1 Item.1.Value Item.2 Item.2.Value Item.3 Item.3.Value
001 A 3 C 7
002 B 4
003 A 2 B 1 F 5
004 C 10 L 3
Each observation contains 1-3 measurements out of a collection of 20 measurements. Also, the same measurement type can appear in multiple columns across different observations.
I need to change it into this:
ID Item Item.Value
001 A 3
001 C 7
002 B 4
003 A 2
003 B 1
003 F 5
004 C 10
004 L 3
Part of my issue is I don’t know the conventional terminology for the configuration of the initial table.
Thanks!