0

I have the following dataframe:

enter image description here

The column NAME will have various financial values (10Y_BOND, SP500, CAC40, etc.)

I am trying to pivot the data so that every value of NAME is a distinct column with row value equal to the current open at that given date.

I already tried the following:

df <- df %>%
       dplyr::select(NAME, date, open) %>%
       pivot_wider(names_from = NAME, values_from = open)

Unfortunately this only does part of the job since the output is in list format since the NAME column not being unique seems to give trouble to the pivoting job. Anyone know how to modify this accordingly?

Thanks!

Nick
  • 125
  • 1
  • 7

0 Answers0