I have a table, shown as below. I need to pivot it so that data is spread horizontally and store it in a txt file with sep = space. But since the number of items per category differs, I am not sure what data structure is the best to use.
I have been stuck with this for 3 days. Could anyone please kindly help me?
Many thanks
data.frame(
name=c(9073050,9073050,9073050,9073050,9073050,9073050,9073050,9073050,9079078,9079078,9085376,9085376,9085376,9085376,9085376),
sequence=c(1,15, 1,10,1, 4, 16,7,18,19,22,14,23,14,24)
)
name sequence
1 9073050 1
2 9073050 15
3 9073050 1
4 9073050 10
5 9073050 1
6 9073050 4
7 9073050 16
8 9073050 7
9 9079078 18
10 9079078 19
11 9085376 22
12 9085376 14
13 9085376 23
14 9085376 14
15 9085376 24
9073050 1 15 1 10 1 4 16 7
9079078 18 19
9085376 22 14 23 14 24