Re: [Rd] Bug in cor() with named array and matrix (PR#7116)

From: <maechler_at_stat.math.ethz.ch>
Date: Tue 20 Jul 2004 - 23:51:21 EST


>>>>> "jusung" == jusung <jusung@andrew.cmu.edu>
>>>>> on Mon, 19 Jul 2004 23:13:01 +0200 (CEST) writes:

    jusung> Full_Name: Ju-Sung Lee
    jusung> Version: 1.9.1
    jusung> OS: Windows XP
    jusung> Submission from: (NULL) (128.2.79.102)


    jusung> The following commands causes R to crash:
    jusung> a = array(1:3)

    jusung> dimnames(a)[[1]] = c('1','2','3')     jusung> cor(a,matrix(1:3))

    jusung> not naming the array seems to work.

yes, indeed.
Thank you for the good bug report.

A shorter version is

   cor(as.array(c(a=1, b=2)), cbind(1:2))

The internals assume to have either a matrix or a vector when the other argument is a matrix.

I'm still thinking about where to fix the bug, in C or in R. What I find is that R also excepts list()s as arguments to cor(), cov(), etc. which I think should rather give an error, IMO. Martin Maechler



R-devel@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-devel Received on Tue Jul 20 23:55:42 2004

This archive was generated by hypermail 2.1.8 : Wed 03 Nov 2004 - 22:45:03 EST