Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to spread data with r

I have my data like that

windspeed      month
1.2             Jan
2               Feb
3.5             Mar
2.6             Apr
5.9             Jun
2.5             Jul

I want to get this kind of data

Jan   Feb   Mar   Apr    Jun   Jul  
1.2    2     3.5    2.6   5.9   2.5  
like image 976
Julien Sawadogo Avatar asked Feb 18 '26 15:02

Julien Sawadogo


1 Answers

What about

t(unstack(DF, windspeed ~ month))

    Apr Feb Jan Jul Jun Mar
res 2.6   2 1.2 2.5 5.9 3.5
like image 175
Chris Watson Avatar answered Feb 20 '26 07:02

Chris Watson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!