Gentleman,
I have to convert a date to this format: nov 2009
A) I've loaded a daily dataset of returns like this:
Date Ret
1 20090729 3.08
B) Naturally, I've transformed Date with as.Date() and now I have:
Date Ret
1 2009-07-29 3.08
Ok, now I want to analyse data also accorpated for months, and weeks, not only daily.
I think the ways to do this can be various:
1) In A), where Date is simply a number, truncate the last two digits of Date (es. 200907). Then I can subset data for month thanks to new Date's format.
2) In B), after Date conversion to date format, proceed with a new format conversion (es. lug 2009)
But, how I can do this with R? I tried with truncate() and strptime() but failed.