I currently have a dataframe that looks like:
State Area Metal Premium
AK AK01 Gold 500
AK AK01 Silver 400
AK AK02 Gold 600
AK AK02 Silver 500
I am trying to create new columns, such that AK01 is in a single row, with separate columns for each metal. Something like
State Area gold_premium silver_premium
AK AK01 500 400
AK AK02 600 500
I was able to create the new columns using
df$gold_premium <- NA
df$silver_premium <- NA
However, I have been unable to move the values into the columns. Any advice helps