RE: [R] sapply behavior

2004-09-28 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

[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

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

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

Re: [R] sapply behavior

2004-09-27 Thread Gabor Grothendieck
Elizabeth Purdom epurdom at 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