From tkeitt@ms.cc.sunysb.edu  Tue Jan 29 20:11:09 2002
From: tkeitt@ms.cc.sunysb.edu (tkeitt@ms.cc.sunysb.edu)
Date: Tue, 29 Jan 2002 21:11:09 +0100 (MET)
Subject: [Rd] dimnames usage in ts (PR#1288)
Message-ID: <200201292011.VAA10838@pubhealth.ku.dk>

Full_Name: Tim Keitt
Version: 1.4
OS: Linux
Submission from: (NULL) (129.49.19.70)


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)
    }

since

> x <- data.frame(matrix(rnorm(100),ncol=10))
> names(x)
 [1] "X1"  "X2"  "X3"  "X4"  "X5"  "X6"  "X7"  "X8"  "X9"  "X10"
> dimnames(x)
[[1]]
 [1] "1"  "2"  "3"  "4"  "5"  "6"  "7"  "8"  "9"  "10"

[[2]]
 [1] "X1"  "X2"  "X3"  "X4"  "X5"  "X6"  "X7"  "X8"  "X9"  "X10"

> dimnames(x) <- list(NULL, names(x))
Error in "dimnames<-.data.frame"(*tmp*, value = list(NULL, names(x))) : 
	invalid dimnames given for data frame
> 

Or else, "dimnames<-.data.frame" has a bug.

T.

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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)
tkeitt@ms.cc.sunysb.edu