Re: [R] Does split() preserve order?

2009-08-26 Thread Charles C. Berry
On Wed, 26 Aug 2009, Alistair Gee wrote: If x is a vector (or data frame) that is in a particular order, and I call split(x, f) to partition x, will the elements of each partition remain in order? They must for example( split ) to work as advertised, viz. ### Calculate z-scores by gr

Re: [R] Does split() preserve order?

2009-08-26 Thread Bert Gunter
ailto:r-help-boun...@r-project.org] On Behalf Of Alistair Gee Sent: Wednesday, August 26, 2009 4:41 PM To: r-help@r-project.org Subject: [R] Does split() preserve order? If x is a vector (or data frame) that is in a particular order, and I call split(x, f) to partition x, will the elements of ea

[R] Does split() preserve order?

2009-08-26 Thread Alistair Gee
If x is a vector (or data frame) that is in a particular order, and I call split(x, f) to partition x, will the elements of each partition remain in order? That is, is the following assertion always TRUE? for(i in split(x, f)) { stopifnot(!is.unsorted(i)) } I suspect that this is the case, but