Hmm, I don't know what this means as trouble shooting, but I get the
following:

1) After library(zoo)

Attaching package: 'zoo'

The following object(s) are masked from 'package:base':

    as.Date

and then for the first str(x)

‘zoo’ series from 2001-01-02 to 2001-01-06
  Data: int [1:5] 1 2 3 4 5
  Index:  Date[1:5], format: "2001-01-02" "2001-01-03" "2001-01-04"
"2001-01-05" "2001-01-06"

There's obviously something afoot in how the Date class is handled, but I'm
not sure how yet.

Michael

On Mon, Aug 29, 2011 at 3:24 PM, Gene Leynes <gleynes+r@gmail.com> wrote:

> This seems like a very strange error.
>
> In trying to troubleshoot this further I looked at the structure of x.  The
> new x has the length of the Index (2001-01-05 = 11327).
>
> > library(zoo)
>
> > x = zoo(1:5, as.Date('2001-01-01')+1:5)
>
> > str(x)
> ‘zoo’ series from 2001-01-02 to 2001-01-06
>   Data: int [1:5] 1 2 3 4 5
>   Index: Class 'Date'  num [1:5] 11324 11325 11326 11327 11328
>
> > x[as.Date('2001-01-05')]
> 2001-01-05
>          4
> > x[as.Date('2001-01-05')] = 0
> > x
> Error in dimnames(x) <- dn :
>   length of 'dimnames' [1] not equal to array extent
> > str(x)
> ‘zoo’ series from 2001-01-02 to 2001-01-06
>   Data: num [1:11327] 1 2 3 4 5 NA NA NA NA NA ...
>   Index: Class 'Date'  num [1:5] 11324 11325 11326 11327 11328
> >
>
>
> Obviously this is hard for anyone to troubleshoot if you can't reproduce
> it. I get the same error in R versions 12.0 and 13.0 (although I don't get
> the "warning zoo was built under R 13.1" warning when I use zoo in R 12.0)
>
>
>
> On Mon, Aug 29, 2011 at 2:07 PM, Gene Leynes <gleynes+r@gmail.com> wrote:
>
>> Michael,
>>
>> By the way, although I replied to David's email, I was responding to you
>> as well.  Your results were exactly what I was expecting, but I didn't get
>> your results.
>>
>>
>>
>> On Mon, Aug 29, 2011 at 1:51 PM, R. Michael Weylandt <
>> michael.weylandt@gmail.com> wrote:
>>
>>> How exactly do you mean it doesn't work? Copied from my GUI:
>>>
>>> > x = zoo(1:5, as.Date('2001-01-01')+1:5)
>>> > x[as.Date('2001-01-05')]
>>> 2001-01-05
>>>          4
>>> > x[as.Date('2001-01-05')] = 0
>>> > x
>>> 2001-01-02 2001-01-03 2001-01-04 2001-01-05 2001-01-06
>>>          1          2          3          0          5
>>>
>>> (Those actually line up correctly on my machine..)
>>>
>>> Michael Weylandt
>>>
>>> On Mon, Aug 29, 2011 at 2:45 PM, Gene Leynes <gleynes+r@gmail.com>wrote:
>>>
>>>> Why doesn't this work?
>>>>
>>>> x = zoo(1:5, as.Date('2001-01-01')+1:5)
>>>> x[as.Date('2001-01-05')]
>>>> x[as.Date('2001-01-05')] = 0
>>>> x
>>>>
>>>>
>>>> I think this is especially bad because it doesn't cause an error.  It
>>>> lets
>>>> you do something to x, but then you can't see x again to see what it
>>>> did.
>>>>
>>>>        [[alternative HTML version deleted]]
>>>>
>>>> ______________________________________________
>>>> R-help@r-project.org mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>> PLEASE do read the posting guide
>>>> http://www.R-project.org/posting-guide.html
>>>> and provide commented, minimal, self-contained, reproducible code.
>>>>
>>>
>>>
>>
>

	[[alternative HTML version deleted]]

