Not sure how to go about cleaning this dataset.. Our database system exports reports by having the field names in one column and the field values in one column, for example:
Field Label 01 | Field Value 01 |
---|---|
Age | 11 |
Proceeds | 4000 |
Age | 4 |
Proceeds | 1000 |
Last Reported | 05-20-2021 |
My goal is to split the fields in column 1 to become their own columns but I also need to pull in the values from column 2 to.
My expected outcome:
Age | Proceeds | Last Reported |
---|---|---|
11 | N/A | N/A |
4 | N/A | N/A |
N/A | 4000 | N/A |
N/A | 1000 | N/A |
N/A | N/A | 05-20-2021 |
I'm not entirely sure how to go about this. I'm new to data wrangling/cleaning and am vaguely familiar with using the tidyverse package.
My plan is to turn the rownames in Field Label 01 into column names then for every instance of each category in Field Label 01 to take the value from Field Value 01 and place it to the right column.
If Field Label 01 = "Age", pull the value in Field Value 01 in the same row into the column Age.
Any help is greatly appreciated!