[R] Calculation with date
Christofer Bogaso
bogaso.christofer at gmail.com
Sat Mar 9 12:41:15 CET 2013
Hello again,
Let say I have an non-negative integer vector (which may be random):
Vec <- c(0, 13, 10, 4)
And I have a date:
> Date <- as.Date(Sys.time())
> Date
[1] "2013-03-09"
Using these 2 information, I want to get following date-vector:
New_Vec <- c("2013-03-01", "2014-04-01", "2014-01-01", "2013-07-01")
Basically the month-difference between 'New_Vec' and 'Date' will be 'Vec '
Is there any R function to do it programmatically?
Thanks for your help.
More information about the R-help
mailing list