News for hackers. Stuff that matters.
Re:The R learning curve by pseut on Friday February 08, 2013 @11:23AM (#5188574)
Ironically, your "iris" object can't be a matrix the way it's written. I've had lots of students get confused about the distinction between matrices and data frames. And sapply will sometimes give (IIRC) matrices of lists with a single element if f is constructed incorrectly (requiring an explicit 'unlist' in the return statement of f). So I generally agree with you, but I think you made shared4you's point.
Re:The R learning curve by mbq on Saturday February 09, 2013 @02:10PM (#5193586)
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.

Re:The R learning curve by pseut on Sunday February 10, 2013 @08:21PM (#5198771)
Cool, I didn't realize that lists could have dimension too. Thanks for the correction.