I have a large data frame that looks like this:
Location Dttm Parameter Unit Value
1 Airport 2018-01-01 12:00:00 Wind Direction deg 60
2 Airport 2018-01-01 12:00:00 Wind Speed m/sec 3.45
Obviously there are many more rows that this, I'm just showing an example of the data. I need to pivot the data so there is a column for wind direction and wind speed. But when I run the pivot_wider function I get something like this:
Location Dttm Unit Wind Direction Wind Speed
1 Airport 2018-01-01 12:00:00 deg 60 NULL
2 Airport 2018-01-01 12:00:00 m/sec NULL 3.45
I've tried various kinds of group_by methods but haven't found anything that gets me what I really need, which is this:
Location Dttm Wind Direction Wind Speed
1 Airport 2018-01-01 12:00:00 60 3.45
I thought pivot_wider would do this for me if I set the id_cols to Dttm but that hasn't worked either. Not even sure how to really google for this solution, so any help is appreciated!!