0

I have this kind of dataset:

data = data.frame(name=c("A","B","C","A","B","A","C"),value=c("one","two","three","four","five","six","seven"))

name    value
A       one
B       two
C       three
A       four
B       five
A       six
C       seven

The expected row in a dataframe starts with A (which is an ID for each record), so the dataframe should look like this:

A                B                C
one              two              three
four             five             NA
six              NA               seven

I've tried experimenting with pivot_wider but with no result. Any suggestion how to solve this is very welcome. Thank you.

0 Answers0