'str' is your friend. Look at the results:
> alpha2=as.Date("2008-12-21")
> alpha1=as.Date("2008-12-21")-as.Date("2008-10-26")
> alpha1
Time difference of 56 days
> alpha2
[1] "2008-12-21"
> alpha1+alpha2
Time difference of 14290 days
Warning message:
Incompatible methods ("Ops.difftime", "+.Date
If you want to do the addition, 'unclass' the variable:
> alpha2+4
[1] "2008-12-25"
> alpha2 + unclass(alpha1)
[1] "2009-02-15"
>
On Tue, Dec 2, 2008 at 4:10 PM, Christophe Dutang <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I'm dealing with dates in R (2.7.2), but some basic operations raise a
> wa
Thanks a lot
Envoyé de mon iPhone
Le 3 déc. 08 à 00:39, "jim holtman" <[EMAIL PROTECTED]> a écrit :
If you want to do the addition, 'unclass' the variable:
alpha2+4
[1] "2008-12-25"
alpha2 + unclass(alpha1)
[1] "2009-02-15"
On Tue, Dec 2, 2008 at 4:10 PM, Christophe Dutang
<[EMAIL
What is odd is that it seems to run ok if we call "+.Date" directly:
> "+.Date"(alpha1, alpha2)
[1] "2009-02-15"
On Tue, Dec 2, 2008 at 4:10 PM, Christophe Dutang <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I'm dealing with dates in R (2.7.2), but some basic operations raise a
> warning.
>
> Incompa
On Wed, 2008-12-03 at 13:18 -0500, Gabor Grothendieck wrote:
> What is odd is that it seems to run ok if we call "+.Date" directly:
>
> > "+.Date"(alpha1, alpha2)
> [1] "2009-02-15"
It also works if you flip the ordering:
> alpha2 + alpha1
[1] "2009-02-15"
Warning message:
Incompatible methods (
On Wed, Dec 3, 2008 at 1:57 PM, Gavin Simpson <[EMAIL PROTECTED]> wrote:
> On Wed, 2008-12-03 at 13:18 -0500, Gabor Grothendieck wrote:
>> What is odd is that it seems to run ok if we call "+.Date" directly:
>>
>> > "+.Date"(alpha1, alpha2)
>> [1] "2009-02-15"
>
> It also works if you flip the orde
On Wed, 2008-12-03 at 14:13 -0500, Gabor Grothendieck wrote:
> >
> > Why it works is not odd if you look at the help for ?`+.Date`, which
> > shows that for this method (correct term?) we need 'date' + 'x', where
> > 'date' is an object of class Date and 'x' is numeric.
>
> In fact what it says i
7 matches
Mail list logo