Schwartz [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 11, 2005 10:16 PM
To: t c
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] adding 1 month to a date
On Tue, 2005-10-11 at 16:26 -0700, t c wrote:
Within an R dataset, I have a date field called date_.
(The dates are
in the format -MM-DD
: [R] adding 1 month to a date
On Tue, 2005-10-11 at 16:26 -0700, t c wrote:
Within an R dataset, I have a date field called date_.
(The dates are
in the format -MM-DD, e.g. 1995-12-01.)
How can I add or subtract 1 month from this date, to get
1996-01-01 or
1995-11-01.
There might
this.
-Original Message-
From: Marc Schwartz [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 11, 2005 10:16 PM
To: t c
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] adding 1 month to a date
On Tue, 2005-10-11 at 16:26 -0700, t c wrote:
Within an R dataset, I have a date
-
From: Marc Schwartz [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 11, 2005 10:16 PM
To: t c
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] adding 1 month to a date
On Tue, 2005-10-11 at 16:26 -0700, t c wrote:
Within an R dataset, I have a date field called date_
On Wed, 12 Oct 2005, Jim Porzak wrote:
OTOH,
seq(as.Date(2004-01-31), by = month, length = 14)
[1] 2004-01-31 2004-03-02 2004-03-31 2004-05-01 2004-05-31
[6] 2004-07-01 2004-07-31 2004-08-31 2004-10-01 2004-10-31
[11] 2004-12-01 2004-12-31 2005-01-31 2005-03-03
I would prefer to
Thanks. How do I se thsi to calculate a new variable (e.g.data$next_month)
from an existing variable (e.g.Data$date_).
I tried : data$next_month-seq(as.Date(data$date_), len = 2, by = month)[2],
but get the following error message: Error in seq.Date(as.Date(data$date),
len = 2, by = 1
Thanks. How do I use this to calculate a new variable (e.g.data$next_month)
from an existing variable (e.g.Data$date_).
I tried : data$next_month-seq(as.Date(data$date_), len = 2, by = month)[2],
but get the following error message: Error in seq.Date(as.Date(data$date),
len = 2, by = 1
To: t c
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] adding 1 month to a date
On Tue, 2005-10-11 at 16:26 -0700, t c wrote:
Within an R dataset, I have a date field called date_.
(The dates are
in the format -MM-DD, e.g. 1995-12-01.)
How can I
Try this:
seq(as.Date(2005-01-15), len = 2, by = month)[2]
or here is another approach:
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/61570.html
On 10/11/05, t c [EMAIL PROTECTED] wrote:
Within an R dataset, I have a date field called date_. (The dates are in
the format -MM-DD, e.g.
Try this. Note that mapply strips off the class which is why we
set up dd with the correct class and then just replaced the values.
# test data
d - as.Date(2005-1-1) + seq(0,90,30)
# calculations, dd is the result
next.month - function(x) seq(x, len = 2, by = months)[2]
dd - d
dd[] -
Within an R dataset, I have a date field called date_. (The dates are in the
format -MM-DD, e.g. 1995-12-01.)
How can I add or subtract 1 month from this date, to get 1996-01-01 or
1995-11-01.
-
[[alternative
On Tue, 2005-10-11 at 16:26 -0700, t c wrote:
Within an R dataset, I have a date field called date_. (The dates are
in the format -MM-DD, e.g. 1995-12-01.)
How can I add or subtract 1 month from this date, to get 1996-01-01 or
1995-11-01.
There might be an easier way to do this, but
12 matches
Mail list logo