As far as I can tell from reading The Fine Documentation (R Language Definition and Intro to R), matrices are supposed to be of homogeneous types. Yet giving matrix() an inhomogeneous list seems to work, although it produces a peculiar object:
v = list(1:3,4,5,"a") m = matrix(v,nrow=2) m [,1] [,2] [1,] Integer,3 5 [2,] 4 "a" m[1,] [[1]] [1] 1 2 3 [[2]] [1] 3 (this is R 2.1.1, running under Linux) Should there be a check/error? Or is this just analogous to the joke about going to the doctor and saying "it hurts when I do this", and the doctor saying "well then, don't do that"? Ben Bolker ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html