Skip to content

several bugs (PR#918) lists and matrices

1 message · Richard M. Heiberger

#
### I got bit again by the same bugs I wrote about a year ago.
### The bugs are related to matrices and arrays of lists.

### 1. There is a clear inconsistency in how R handles two
### functionally equivalent statements.
### array() is able to take a list and create a matrix.
### matrix() is unable to create that matrix.
[[1]]
NULL

[[2]]
NULL
[,1]  
[1,] "NULL"
[2,] "NULL"
NULL
[1] TRUE
[1] TRUE
Error in matrix(vector("list", 2), nrow = 2) : 
	Unimplemented feature in copyVector
### 2. Here the matrix single-[ subscript is doing the wrong thing,
### without giving a warning.
[,1]   [,2]  
[1,] "NULL" "NULL"
[[1]]
NULL
NULL
[[1]]
NULL
NULL
[[1]]
[1] "abc"
[[1]]
[1] "abc"
[1] "abc"
[[1]]
NULL
[1] "abc"
Error: incompatible types in subset assignment
### 3. subsetting a vector of lists doesn't behave the way I anticipate.
### It looks like NULL is not handled consistently inside a vector.
### Sometimes it can be an element, sometimes not.
[[1]]
NULL

[[2]]
NULL
[[1]]
[1] "abcd"

[[2]]
NULL
[[1]]
NULL
### This time the issue came up in an attempt to make abind work with R.
### abind() is a generalization of rbind and cbind to arrays.
### Tony Plate and I posted it to StatLib in 1996
### (http://lib.stat.cmu.edu/S/abind).

### I would like you to consider adding abind to R.
### The posted abind doesn't work in R, for the reasons above and due to
### a difference in behavior of match.call between S -Plusand R that I am
### reporting in a separate bug report.
### There are two revised files, currently available at
### http://surfer.sbm.temple.edu/~rmh/abind.r
### http://surfer.sbm.temple.edu/~rmh/abind.test.in.r
### The documentation in statlib applies to these files.
### I will update the statlib version after I understand why R differs.
_              
platform i386-pc-mingw32
arch     x86            
os       Win32          
system   x86, Win32     
status                  
major    1              
minor    4.1            
year     2002           
month    01             
day      30             
language R
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._