Bugzilla – Bug 7116
Bug in cor() with named array and matrix
Last modified: 2004-07-20 18:51:04 UTC
Full_Name: Ju-Sung Lee
OS: Windows XP
Submission from: (NULL) (184.108.40.206)
The following commands causes R to crash:
a = array(1:3)
dimnames(a)[] = c('1','2','3')
not naming the array seems to work.
From: Martin Maechler <email@example.com>
>>>>> "jusung" == jusung <firstname.lastname@example.org>
>>>>> 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) (220.127.116.11)
jusung> The following commands causes R to crash:
jusung> a = array(1:3)
jusung> dimnames(a)[] = c('1','2','3')
jusung> not naming the array seems to work.
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,
Fixed in 1.9.1 patched
Audit (from Jitterbug):
Mon Jul 26 09:22:42 2004 ripley changed notes
Mon Jul 26 09:22:42 2004 ripley moved from incoming to Analyses-fixed