[R] array() misfeature
Duncan Murdoch
murdoch at stats.uwo.ca
Sun Dec 2 19:02:52 CET 2007
On 02/12/2007 11:49 AM, Allen McIntosh wrote:
> Version: 2.5.1
That's an obsolete version, but the issue is still present in R-devel.
> array() is inconsistent when given non-integral dimensions:
>
>> zz <- array(0,dim=c(4,3.01))
>> dim(zz)
> [1] 4 3
>> zz <- array(0,dim=c(201,4.05))
> Error in dim(data) <- dim : dim<- : dims [product 804] do not match the length of object [814]
>
>
> [IMHO the code that did this is broken. My copy of it has been
> fixed. Consistent behavior and/or a clearer error message would
> just have made it easier to find the problem.]
>
I'll add code to coerce dim to integer before using it. Thanks for the
report.
Duncan Murdoch
More information about the R-help
mailing list