[R] What is the function to test if a vector is ordered or not?

2009-12-09 Thread Peng Yu
I did a search on www.rseek.org to look for the function to test if a vector is ordered or not. But I don't find it. Could somebody let me know what function I should use? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] What is the function to test if a vector is ordered or not?

2009-12-09 Thread Marc Schwartz
On Dec 9, 2009, at 10:10 PM, Peng Yu wrote: I did a search on www.rseek.org to look for the function to test if a vector is ordered or not. But I don't find it. Could somebody let me know what function I should use? If by ordered, you mean sorted, then ?is.unsorted is.unsorted(c(1, 4, 2,

Re: [R] What is the function to test if a vector is ordered or not?

2009-12-09 Thread jim holtman
Try all(diff(order(yourVector)) == 1) On Wed, Dec 9, 2009 at 10:10 PM, Peng Yu pengyu...@gmail.com wrote: I did a search on www.rseek.org to look for the function to test if a vector is ordered or not. But I don't find it. Could somebody let me know what function I should use?