Hello @Tati ,
you are confusing me.
You show me some code and therefore I suppose that you have executed it.
For instance you did rename the names of the columns and after that you show the first lines with head
.
The result shows the names as Date Price Index Total Return Index Date2
When I do the same I get
head(p)
Date Price_Index Tot_Ret_Index Date2
1 06/05/2006 100.0 100.00 2006-06-05
2 06/06/2006 90.7 90.68 2006-06-06
3 06/07/2006 86.2 86.19 2006-06-07
and I would except to see the same names in your output. So something is wrong.
I notice that you are editing the code and its output in this conversation and its easy (and therefore confusing) to make a mistake in that. The best way to avoid that is just copying the contents of the R-console into the window where you pose or answer questions . When you use three backticks (`) before and after your copied text it will be correctly readable.
Also read about the possibilities of the reprex
package. See e.g. here
I second the suggestion of @nirgrahamuk for a good introductory text.