cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
terapin
Level VI

JSL Summarize Command Creates 2 lists, one that behaves "normally", the other not.

Hi Folks,

The code below creates a data table and then creates two lists in the Summarize command, one for the By variable (date_list) and one for the Max variable (data_list).  The date_list is fully accessible using standard List commands (see code at bottom), but the data_list isn't a list as far as Is List (data_list) is concerned.  In addition, I can't count the number of items in the list, nor Show the location of a specific value in the data_list.  Is this normal behavior for a list or am I missing something subtle here about lists?  Any help would be appreciated.  Thanks

Clear Log();

Names Default To Here(1);

dt1 = New Table( "Test",

  Add Rows( 20 ),

  New Column( "Date",

  Numeric,

  Continuous,

  Format( "m/d/y h:m", 10 ),

  Input Format( "m/d/y h:m" ),

  Set Values(

  [1767245800, 1771173900, 1805155800, 1809197400, 1843086800, 1838161000, 1889049900, 1893293200,

  1896320800, 1900281600, 1950766400, 1955499200, 1957751200, 1964247600, 1990396800, 1995976400,

  2023788000, 2029549600, 2051488600, 2056959000]

  )

  ),

  New Column( "Data",

  Numeric,

  Continuous,

  Format( "Best", 12 ),

  Set Values( [34, 45, ., 56, 99, 67, 12, 78, 53, 89, 77, 90, ., 12, 73, 23, 12, 34, 6, 45] )

  ),

  New Column( "Year", Numeric, Continuous, Format( "Best", 12 ), Formula( Year( :Date ) ), Lock( 1 ) ),

  New Column( "Hour", Numeric, Continuous, Format( "Best", 12 ), Formula( Hour( :Date ) ), Lock( 1 ) )

);

Wait( 2 );

// Get the highest growth for each day

Summarize( date_list = by( :Date ), data_list = Max( :Data ) );

Is List( date_list );

N Items ( date_list );

Show( Loc( date_list, "03/15/1961 12:10 AM" ));

Is List( data_list );

N Items ( data_list );

Show( Loc( data_list, 45 ));

1 ACCEPTED SOLUTION

Accepted Solutions
ms
Super User (Alumni) ms
Super User (Alumni)

Re: JSL Summarize Command Creates 2 lists, one that behaves "normally", the other not.

It's only the by() result of summarize that is a list. The numerical output is typically a matrix (i.e. a vector). Use matrix commands or convert the matrix to a list.

Compare these alternatives:


Is Matrix( data_list );

N Row( data_list );

Show( Loc( data_list == 45 ));


Is List( data_list = As List( data_list ) );

N Items( data_list );

Show( Loc( data_list, 45 ) );

View solution in original post

2 REPLIES 2
ms
Super User (Alumni) ms
Super User (Alumni)

Re: JSL Summarize Command Creates 2 lists, one that behaves "normally", the other not.

It's only the by() result of summarize that is a list. The numerical output is typically a matrix (i.e. a vector). Use matrix commands or convert the matrix to a list.

Compare these alternatives:


Is Matrix( data_list );

N Row( data_list );

Show( Loc( data_list == 45 ));


Is List( data_list = As List( data_list ) );

N Items( data_list );

Show( Loc( data_list, 45 ) );

terapin
Level VI

Re: JSL Summarize Command Creates 2 lists, one that behaves "normally", the other not.

Ah, as usual, the devil is in the details.  Thanks for the description and alternatives.  That helped me understand the difference between a list and matrix a lot better.