RE: [R] sapply behavior

2004-09-27 Thread Prof Brian Ripley
On Mon, 27 Sep 2004, Liaw, Andy wrote: > The problem is that temp2 is a data frame, and the function you are > sapply()ing to returns a row from a data frame. A data frame is really a > list, with each variable corresponding to a component. If you extract a row > of a data frame, you get another

Re: [R] sapply behavior

2004-09-27 Thread Gabor Grothendieck
Elizabeth Purdom stanford.edu> writes: : : Hi, : : I use sapply very frequently, but I have recently noticed a behavior of : sapply which I don't understand and have never seen before. Basically, : sapply returns what looks like a matrix, says it a matrix, and appears to : let me do matrix

Re: [R] sapply behavior

2004-09-27 Thread Douglas Bates
Elizabeth Purdom wrote: I use sapply very frequently, but I have recently noticed a behavior of sapply which I don't understand and have never seen before. Basically, sapply returns what looks like a matrix, says it a matrix, and appears to let me do matrix things (like transpose). But it is al

RE: [R] sapply behavior

2004-09-27 Thread Liaw, Andy
The problem is that temp2 is a data frame, and the function you are sapply()ing to returns a row from a data frame. A data frame is really a list, with each variable corresponding to a component. If you extract a row of a data frame, you get another data frame, not a vector, even if all variables

[R] sapply behavior

2004-09-27 Thread Elizabeth Purdom
Hi, I use sapply very frequently, but I have recently noticed a behavior of sapply which I don't understand and have never seen before. Basically, sapply returns what looks like a matrix, says it a matrix, and appears to let me do matrix things (like transpose). But it is also a list and behave