4 ms·
Nope; this entity you describe is not a matrix of lists but a single list with dimension, and sapply creates it when mapped function returns list with the same
by mbq 14y ago
Nope; this entity you describe is not a matrix of lists but a single list with dimension, and sapply creates it when mapped function returns list with the same length for all iterations (which is a perfectly consistent behaviour to how sapply treats vector output).
The confusion is from the fact that people think that matrices (or data frames) are R's base types -- they are not, only vectors and lists are. Matrix is just something with dim attribute, data frame is a list of equal-length elements with a proper class.
- pseut 14y agoCool, I didn't realize that lists could have dimension too. Thanks for the correction.