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

tkeitt@ms.cc.sunysb.edu tkeitt@ms.cc.sunysb.edu
Tue, 29 Jan 2002 21:11:09 +0100 (MET)


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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._