I need your help reshaping my district-level daily temperature data from a wide to a long format.
I have provided a snapshot of my data below.
In the full dataset, the dates range from 1 January 2010 to 31 December 2010.
After reshaping, my final data should have a column titled "districts", "dates" and "temperature".
22/12/2010 | 23/12/2010 | 24/12/2010 | 25/12/2010 | 26/12/2010 | 27/12/2010 | 28/12/2010 | 29/12/2010 | 30/12/2010 | 31/12/2010 | district |
290.42316 | 290.901957 | 290.734693 | 290.79091 | 290.825307 | 290.452145 | 289.745414 | 290.255769 | 289.986327 | 290.213195 | Kiambu |
289.481211 | 289.885756 | 289.451988 | 289.767927 | 289.649287 | 289.153357 | 288.50605 | 289.048894 | 288.718642 | 288.92301 | Kirinyaga |
293.614437 | 293.97406 | 293.782521 | 294.27897 | 294.155162 | 293.696184 | 293.107893 | 293.79007 | 293.65899 | 293.840799 | Machakos |
289.207302 | 289.550169 | 289.3492 | 289.693667 | 289.658836 | 289.180405 | 288.488866 | 289.215417 | 288.847019 | 288.924391 | Murang'a |
289.288837 | 289.7971 | 289.618359 | 289.631393 | 290.327304 | 289.866269 | 288.860669 | 289.378584 | 289.493381 | 289.696221 | Nyandarua |
289.563779 | 290.08223 | 289.613974 | 289.742309 | 290.000783 | 289.236923 | 288.369696 | 289.150477 | 288.96267 | 289.007754 | Nyeri |
300.711855 | 300.66441 | 300.18528 | 300.410653 | 300.731155 | 300.436221 | 300.53266 | 300.752484 | 300.353821 | 300.444164 | Kilifi |
299.950987 | 300.133282 | 299.710488 | 299.877987 | 299.976884 | 299.445853 | 299.535585 | 300.018341 | 299.801684 | 299.864323 | Kwale |
301.295454 | 301.08952 | 300.471525 | 300.529891 | 301.209784 | 300.572103 | 300.901886 | 301.213524 | 300.948301 | 300.673431 | Lamu |
300.134964 | 300.254665 | 299.859483 | 300.240489 | 300.404015 | 299.917327 | 299.962994 | 300.233772 | 299.975998 | 300.343877 | Mombasa |
298.248242 | 298.587084 | 298.223512 | 298.31255 | 298.57019 | 297.938847 | 297.78606 | 298.416717 | 297.907583 | 297.759021 | Taita Taveta |
302.242976 | 302.18383 | 301.706147 | 301.55664 | 301.987383 | 301.566071 | 301.623938 | 301.890389 | 301.22068 | 301.330906 | Tana River |
292.718341 | 293.402177 | 292.95594 | 293.089097 | 293.058324 | 292.351082 | 291.739324 | 292.541505 | 292.338334 | 292.59647 | Embu |
300.488048 | 301.121816 | 300.67348 | 300.509714 | 300.712365 | 300.257019 | 300.060362 | 300.069667 | 299.507594 | 299.979497 | Isiolo |
298.730816 | 299.010331 | 298.981171 | 299.147314 | 299.156926 | 298.213189 | 297.696936 | 298.756034 | 298.212052 | 298.317001 | Kitui |
0 Response to How to reshape data with dates as variable names?
Post a Comment