Skip to content

matrix lists

3 messages · Brian Ripley, Agustin Lobo

#
Perhaps the following example will help demonstrate that matrix lists do
exist and do work up to a point, despite strident assertions on R-help to
the contrary:
[,1]        [,2]
[1,] "Numeric,3" "Numeric,1"
[2,] "Numeric,3" "Character,3"
[1] TRUE
[1] 3.141593
[1] "a" "b" "c"

In S m[2,2] extracts a sub-list, but that seems not to work correctly in R:
neither does m[,2].  I am reporting that as a bug.
#
On Tue, 26 Feb 2002, Prof Brian D Ripley wrote:

            
The bug is now fixed in R-devel, which should make these more useful.
#
Strident assertions?

My (non strident) assertion was about
matrices, not about matrix lists (which nobody said that would not exist).
In your example you omit the fact that
is.list(m) also results in TRUE:
[1] TRUE
[1] TRUE
[[1]]
NULL

So it's a matrix and it's a list.
The NULL result of m[1,1] (that I pointed to you), might be, as you say, a
bug. But in any case, objects such as m in the example
are not what most people would understand as a matrix.
It's a different type of object. And the original message said
" ...I tried to create a matrix from a list..." 
The "normal" matrix would yield FALSE for is.list():
[1] TRUE
[1] FALSE
[1] 1
On Tue, 26 Feb 2002, Prof Brian D Ripley wrote:

            
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._