Skip to content
Prev 79493 / 398502 Next

peculiar matrices

On Fri, 2005-10-21 at 21:32 +0000, Ben Bolker wrote:
Ben,

If you review the structure of 'm' note:
List of 4
 $ : int [1:3] 1 2 3
 $ : num 4
 $ : num 5
 $ : chr "a"
 - attr(*, "dim")= int [1:2] 2 2

that it is actually a list, even though:
[1] "matrix"


Also:
[1] "list"
[1] "list"


If you remove the dim attributes, you get:
[[1]]
[1] 1 2 3

[[2]]
[1] 4

[[3]]
[1] 5

[[4]]
[1] "a"


So I would argue that it is consistent with the documentation in that,
while the printed output is that of a matrix, it is a list, which of
course can handle heterogeneous data types.

This is Version 2.2.0 Patched (2005-10-20 r35979).
Maybe more like:

"Doctor, my eye hurts when I drink my tea." and the doctor says, "Well,
remove the spoon from the cup before you drink."

;-)

Regards,

Marc Schwartz