Dataframe consist of 3 rows: wine_id, taste_group and and evaluated matching score for each of that group:
wine_id | taste_group | score |
---|---|---|
22 | tree_fruit | 87 |
22 | citrus_fruit | 98 |
22 | tropical_fruit | 17 |
22 | earth | 8 |
22 | microbio | 6 |
22 | oak | 7 |
22 | vegetal | 1 |
How to achieve to make a separate column for each taste_group and to list scores in rows? Hence this:
wine_id | tree_fruit | citrus_fruit | tropical_fruit | earth | microbio | oak | vegetal |
---|---|---|---|---|---|---|---|
22 | 87 | 98 | 17 | 8 | 6 | 7 | 1 |
There are 13 taste groups overall, along with more than 6000 Wines. If the wine doesn't have a score for taste_group row takes value 0.
I used
length(unique(tastes$Group))
length(unique(tastes$Wine_Id))
in R to question basic measures. How to proceed to wanted format?
. with couple warning messages considering values_fn. How to return only dataframe with score values?