I am trying to pivot a table from long to wide but it would appear that some of the values go missing when I try to pivot the table. The original data frame looks like this (with a new id, the same dates repeat themselves all over again):
This table has a data frame dimension of 1520 times 4. Below is the code that I used to pivot the table:
SecurityPrice_1 <- SecurityPrice_1 %>% rename(Ticker_name = Id) SecurityPrice_1<- spread(SecurityPrice_1, Ticker_name, p_price)
It now only has a dimension of 80 times 21, which is a lot smaller and makes no sense whatsoever. I can only show one picture because I am a new user but essentially all the duplicated dates from the previous table get deleted. Is there a way that I can simply preserve all the dates and still count all the values while using spread? Can someone please help me out? It would be greatly appreciated!