I have a factored time series that looks like this:
df <- data.frame(a=c("11-JUL-2004", "11-JUL-2005", "11-JUL-2006",
"11-JUL-2007", "11-JUL-2008"),
b=c("11-JUN-1999", "11-JUN-2000", "11-JUN-2001",
"11-JUN-2002", "11-JUN-2003"))
First, I would like to convert this to a format native to R. Second, I would like to calculate the number of months between the two columns.
Update:
Essentially I'm trying to recreate what I do in SPSS, in R.
In SPSS I would:
- Convert the strings to date format DD-MMM-YYYY
- COMPUTE. RND((a-b)/60/60/24/30.416)
30.416 is short for 365/12 I don't care so much about month edge cases, hence the rounding operation.