I am going crazy with the as.Date function in R. I just do not understand why my code does not work.
Here, you find the data:
irates_monthly = c("2000-01", "2000-02", "2000-03", "2000-04", "2000-05", "2000-06", "2000-07", "2000-08", "2000-09", "2000-10", "2000-11", "2000-12", "2001-01", "2001-02", "2001-03", "2001-04")
which is of type 'character'.
Now, here is my code:
as.Date(irates_monthly, format = '%Y-%m')
The only thing I want, is to transform the character vector 'irates_monthly' into a Date object such that I can use it in the xts() function with the argument 'order.by'.
I am sure this is very simple but I just do not see the mistake. Any help is very much appreciated! Also searching through stackoverflow did not resolve my problem!
I am very thankful for any hints, or solutions!
All the best,
Manuel