0

My data set is monthly from Jan 1997 to Dec 2021. I need the month code to be in the correct format, however as.date doesn't recognise the cell contents as they are. Please help.

 Month BrentSpot     GDP Agriculture Production Construction Services
1 Jan-1997     23.54 63.8229     53.5614    81.9963      87.2775  59.4453
2 Feb-1997     20.85 64.7182     53.9091    82.1917      87.8350  60.5018
3 Mar-1997     19.13 64.9264     54.2569    81.6142      88.6714  60.8375
4 Apr-1997     17.56 65.2327     55.1264    82.0006      89.5170  61.0981
5 May-1997     19.02 64.7336     55.8220    82.0093      89.8144  60.4470
6 Jun-1997     17.58 65.1322     56.3438    82.3350      89.4891  60.8886
Daedomdan
  • 73
  • 5
  • 1
    Strongly related if not an exact dupe: https://stackoverflow.com/q/6242955/903061. Do you want a `Date` format (presumably using the first of each month?) Or you could use the `yearmon` class implemented in the `zoo` package. Or are you just wanting to change the format - in which case what is the desired output? What do you consider the correct format? – Gregor Thomas Mar 09 '22 at 18:12

1 Answers1

1

Gdp_Brent_Table$Month = seq(ymd('1997-01-01'),ymd('2021-12-01'), by = 'months')

(this seemed to do the trick)

Daedomdan
  • 73
  • 5