Entering edit mode
19 months ago
sata72
•
0
I have a 22 sample, with another column information about each sample, i want to change the samples to another format as below in output in R. Anyone know how I can do this?
Thank you
id position percent
sample1 1200 30
sample2 1200 20
sample3 1200 10
....
sample22 1200 40
sample1 1202 50
sample2 1202 30
sample3 1202 20
....
sample22 1202 60
Output:
position sample1 sample2 sample3 ...... sample22
1200 30 20 10 40
1202 50 30 20 60
pivot_wider()
-- the manual will tell you how to use it.