Hello:
I have the following dataset in long format:
I would like to reshape into wide but am having trouble knowing how to define the i,j, and base names to make this work.
What I would like it to look like eventually (using id 1 as an example) is where I would have the dataset organized by id and with each measurement and corresponding value by datetime:
Thank you for assistance.
I have the following dataset in long format:
Code:
input double(id datetime) str32 measurement double value 1 1906654020000 "height" 1800 1 1906654020000 "weight" 50 1 1906654020000 "length" 90 1 1906654020000 "width" 42 1 1.9066542e+12 "height" 1900 1 1.9066542e+12 "weight" 50 1 1.9066542e+12 "length" 92 1 1.9066542e+12 "width" 40 1 1.9066542e+12 "depth" 880 1 1.9066545e+12 "height" 2000 1 1.9066545e+12 "weight" 54 1 1.9066548e+12 "height" 1900 1 1.9066548e+12 "width" 41 1 1.9066548e+12 "depth" 860 2 1.9092456e+12 "height" 1500 2 1.9092456e+12 "weight" 55 2 1.9092456e+12 "length" 92 2 1.9092456e+12 "width" 45 2 1.9092456e+12 "depth" 800 2 1.9092459e+12 "height" 1800 2 1.9092459e+12 "weight" 58 2 1.9092459e+12 "width" 40 2 1.9092462e+12 "length" 94 2 1.9092462e+12 "width" 42 3 1.9066542e+12 "height" 2010 3 1.9066542e+12 "weight" 55 3 1.9066542e+12 "length" 98 3 1.9066542e+12 "width" 48 3 1.9066542e+12 "depth" 820 3 1906654320000 "height" 1900 3 1906654320000 "weight" 52 3 1906654320000 "depth" 850 4 1.943424e+12 "height" 1800 4 1.943424e+12 "weight" 50 4 1.943424e+12 "length" 99 4 1.943424e+12 "width" 42 4 1.9434243e+12 "height" 1700 4 1.9434243e+12 "weight" 57 4 1.9434243e+12 "length" 94 4 1.9434243e+12 "width" 44 4 1.9434243e+12 "depth" 870 end format %tcCCYY-NN-DD_HH:MM datetime
What I would like it to look like eventually (using id 1 as an example) is where I would have the dataset organized by id and with each measurement and corresponding value by datetime:
id | datetime | height | weight | length | width | depth |
1 | 2020-06-01 18:07 | 1800 | 50 | 90 | 42 | . |
1 | 2020-06-01 18:10 | 1900 | 50 | 92 | 40 | 880 |
1 | 2020-06-01 18:15 | 2000 | 54 | . | . | . |
1 | 2020-06-01 18:20 | 1900 | . | . | 41 | 860 |
Comment