From p.dalgaard@biostat.ku.dk  Tue Jan 29 20:57:51 2002
From: p.dalgaard@biostat.ku.dk (Peter Dalgaard BSA)
Date: 29 Jan 2002 21:57:51 +0100
Subject: [Rd] dimnames usage in ts (PR#1288)
In-Reply-To: <200201292011.VAA10838@pubhealth.ku.dk>
References: <200201292011.VAA10838@pubhealth.ku.dk>
Message-ID: <x2665kub74.fsf@blueberry.kubism.ku.dk>

tkeitt@ms.cc.sunysb.edu writes:

> I think this code in 'ts' is incorrect:
> 
>     if (is.matrix(data) || is.data.frame(data)) {
>         nseries <- ncol(data)
>         ndata <- nrow(data)
>         dimnames(data) <- list(NULL, names)
>     }
...
> Or else, "dimnames<-.data.frame" has a bug.

It doesn't (well, this isn't one...). A data frame must have unique
rownames, so trying to set them to NULL is wrong, as you say. 

The fix would seem to be something like replacing the last line with

if (is.null(dimnames(data)))
        dimnames(data) <- list(NULL, names)
else
        dimnames(data)[[2]] <- name

Did you actually get bitten by this one?

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] dimnames usage in ts (PR#1288)
Peter Dalgaard BSA