I have a csv. file containing a prices series of a commodity from 1997 to 2018, in weekly - string format and it has exactly 52 observations per year. Which means, a week is defined as a seven day week. I want to convert this to a new data frame of xts format, containing weekly(7 day week) timeseries data ( in order to be compatible with ugarch package). I am new to xts format and do not know how to convert. Thank you very much in advance.
This is how my data look like;
week price
1997-week1 32.1
1997-week2 30.8
1997-week3 24.6
1997-week4 24.7
1997-week5 22.1
1997-week6 22.8
1997-week7 26.8
1997-week8 24
1997-week9 23.5
1997-week10 22.4
1997-week11 21.9
1997-week12 21.1
.
.
1997-week52 51.5
.
.
1998-week1 54
1998-week2 51.5
.
.
2018-week52 117.5