I think you want the following, assuming you defined your function g():
gValues = apply(S, 1, g);
Sordered = S[order(gValues), ]
Peter
On Fri, Jan 21, 2011 at 11:38 AM, Francesco Petrogalli
wrote:
> Hi,
> is there a R function that order a matrix according to some criteria
> based on the rows(
look at 'order'
yourMatrix[order(yourMatrix[, 'yourCol']), ]
On Fri, Jan 21, 2011 at 2:38 PM, Francesco Petrogalli
wrote:
> Hi,
> is there a R function that order a matrix according to some criteria
> based on the rows(or cols) of that matrix?
>
> For example, let's say that my matrix S is compo
Hi,
is there a R function that order a matrix according to some criteria
based on the rows(or cols) of that matrix?
For example, let's say that my matrix S is composed by n rows S_1,
S_2,.., S_n and that I compute some real value g_i=g(S_i) for each
row.
Then I want to order this set of g_i (from
3 matches
Mail list logo