[R] Subtracting number of days from a date

Gabor Grothendieck ggrothendieck at myway.com
Wed May 26 18:36:20 CEST 2004


Hoeven, Maarten van der <Maarten.van.der.Hoeven <at> knmi.nl> writes:

: suppose I have a date, say May 15 2004, and I want to now what date it is 23 
days before that date. The way to
: calculate the new date should (...) take account of leap years :)
: 
: In pseudocode:
: 
: olddate <- "May 15 2004"
: newdate <- olddate-23
: 
: I looked around in POSIXct etc..., maybe I overlooked?

as.Date("2005-05-24")-23




More information about the R-help mailing list