I know that this must be answered somewhere, but I cant seem to find a solution.
I have the following
id qid val
A X 5
A Y 4
A Z 3
B X 2
B Y 1
I would like it to look like this
id X Y Z
A 5 4 3
B 2 1 NA
Where each id
has a unique column.
Here is the data for easy copy-paste
tribble(
~id, ~qid, ~val,
"A", "X", 5,
"A", "Y", 4,
"A", "Z", 3,
"B", "X", 2,
"B", "Y", 1
)