Hi All, I have certain combinations for which I have some value, e.g. 0 1 20 0 2 15 1 1 40 1 2 52 Now I need to sort this list for which I'll get the combination against the lowest value. In this case, 15, and the combination will be 0 2. -- SUMANTA BASAK. [[alternative HTML version deleted]]
On 4/6/06 8:04 AM, "Sumanta Basak" <sumanta24 at gmail.com> wrote:> Hi All, > > > > I have certain combinations for which I have some value, e.g. > > > > 0 1 20 > > 0 2 15 > > 1 1 40 > > 1 2 52 > > > > Now I need to sort this list for which I'll get the combination against the > lowest value. In this case, 15, and the combination will be 0 2.See ?order. You can use the ordering that you get from order() to grab the appropriate entry in your matrix/data.frame. Sean
From: Sean Davis> > On 4/6/06 8:04 AM, "Sumanta Basak" <sumanta24 at gmail.com> wrote: > > > Hi All, > > > > > > > > I have certain combinations for which I have some value, e.g. > > > > > > > > 0 1 20 > > > > 0 2 15 > > > > 1 1 40 > > > > 1 2 52 > > > > > > > > Now I need to sort this list for which I'll get the combination > > against the lowest value. In this case, 15, and the > combination will > > be 0 2. > > See ?order. You can use the ordering that you get from > order() to grab the appropriate entry in your matrix/data.frame. > > SeanIf Sumanta just wants the entry with the minimum, there's no need to sort the whole thing. which.min() should work. Andy