Subscribe Bookmark RSS Feed

summarize (by..) does not result in value order of column

h_lazar

Community Trekker

Joined:

Jun 23, 2011

When using the summarize function to generate a table of statistics, the resulting table does not result in the value order property. Is there a way to force the order of a summarize table by the value order property of the column?

In the example below, ls_factor column has a manually set value order.


dt0 = Current Data Table();


ls_collist = dt0 << get column names( string );


//find first parameter column


i_colstart = Contains( ls_collist, "CP_STARTTIME" ) + 1;



r_ColDlg = Column Dialog( col_id = Col List( "X , Factor(s)" ) );


ls_factor = r_ColDlg["col_id"];



For( i = i_colstart, i <= N Items( ls_collist ), i++,


  ycol = Column( dt0, i );


  Summarize(


  s = by( Eval( ls_factor ) ),


  d_mean = Mean( ycol ),


  d_median = Quantile( ycol, 0.5 ),


  d_stdev = Std Dev( ycol ),


  d_min = Min( ycol ),


  d_max = Max( ycol )


  );


);