As Table
As Table using For
Summary: Generates a table with a specific pattern of ones, utilizing a For loop to populate the matrix and then converting it to a table.
Code:
//
d = J( 81, 81, 0 );
For( i = 1, i <= 81, i++,
d[i, 1 :: i] = 1
);
As Table( d[0, 2 :: 80] );
Code Explanation:
- Initialize 81x81 matrix
d. - Loop through rows 1 to 81.
- Set diagonal and lower triangle to 1.
- Convert matrix
dto table. - Exclude first row from table.
- Exclude first column from table.
- Display resulting table.
As Table using New Window
Summary: Creates and configures new windows with column list boxes and filter column selectors, demonstrating data retrieval and interactive filtering capabilities in JMP.
Code:
dt = Open("data_table.jmp");
myitems = dt << get column names( string );
nw1 = New Window( "Col List Box Example", Col List Box( all, width( 250 ), maxSelected( 1 ) ), fontobj = lb = Col List Box() );
lb << Set Items( myitems );
lb << Get Items;
nw2 = New Window( "Filter Col Selector Example", fontobj = lb = Filter Col Selector( width( 250 ) ) );
myend = Tick Seconds();
Close( dt, nosave );
nw1 << close window;
nw2 << close window;
n = 20;
p = 10000;
dt1 = As Table( (J( n / 2, 1, 0 ) |/ J( n / 2, 1, 1 )) || J( n, p, Random Normal() ) );
mystart1 = Tick Seconds();
myitems = dt1 << get column names( string );
nw1 = New Window( "Col List Box Example", Col List Box( all, width( 250 ), maxSelected( 1 ) ), fontobj = lb = Col List Box() );
lb << Set Items( myitems );
lb << Get Items;
myend1 = Tick Seconds();
mystart2 = Tick Seconds();
nw2 = New Window( "Filter Col Selector Example", fontobj = lb = Filter Col Selector( width( 250 ) ) );
myend2 = Tick Seconds();
Close( dt1, nosave );
nw1 << close window;
nw2 << close window;
n = 20;
p = 100000;
dt1 = As Table( (J( n / 2, 1, 0 ) |/ J( n / 2, 1, 1 )) || J( n, p, Random Normal() ) );
mystart1 = Tick Seconds();
myitems = dt1 << get column names( string );
nw1 = New Window( "Col List Box Example", Col List Box( all, width( 250 ), maxSelected( 1 ) ), fontobj = lb = Col List Box() );
lb << Set Items( myitems );
lb << Get Items;
myend1 = Tick Seconds();
mystart2 = Tick Seconds();
nw2 = New Window( "Filter Col Selector Example", fontobj = lb = Filter Col Selector( width( 250 ) ) );
myend2 = Tick Seconds();
Close( dt1, nosave );
nw1 << close window;
Code Explanation:
- Open data table.
- Retrieve column names.
- Create new window with column list box.
- Set items in column list box.
- Get items from column list box.
- Create new window with filter column selector.
- Record end time.
- Close data table without saving.
- Close windows.
- Repeat steps 1-9 with different data sizes.
As Table using Tick Seconds
Summary: Creates and configures two windows with a column list box and filter col selector in JMP, utilizing data table operations and timing measurements.
Code:
mystart = Tick Seconds();
dt = Open("data_table.jmp");
myitems = dt << get column names( string );
nw1 = New Window( "Col List Box Example", Col List Box( all, width( 250 ), maxSelected( 1 ) ), fontobj = lb = Col List Box() );
lb << Set Items( myitems );
lb << Get Items;
nw2 = New Window( "Filter Col Selector Example", fontobj = lb = Filter Col Selector( width( 250 ) ) );
myend = Tick Seconds();
Close( dt, nosave );
nw1 << close window;
nw2 << close window;
n = 20;
p = 10000;
dt1 = As Table( (J( n / 2, 1, 0 ) |/ J( n / 2, 1, 1 )) || J( n, p, Random Normal() ) );
mystart1 = Tick Seconds();
myitems = dt1 << get column names( string );
nw1 = New Window( "Col List Box Example", Col List Box( all, width( 250 ), maxSelected( 1 ) ), fontobj = lb = Col List Box() );
lb << Set Items( myitems );
lb << Get Items;
myend1 = Tick Seconds();
mystart2 = Tick Seconds();
nw2 = New Window( "Filter Col Selector Example", fontobj = lb = Filter Col Selector( width( 250 ) ) );
myend2 = Tick Seconds();
Close( dt1, nosave );
nw1 << close window;
nw2 << close window;
n = 20;
p = 100000;
dt1 = As Table( (J( n / 2, 1, 0 ) |/ J( n / 2, 1, 1 )) || J( n, p, Random Normal() ) );
mystart1 = Tick Seconds();
myitems = dt1 << get column names( string );
nw1 = New Window( "Col List Box Example", Col List Box( all, width( 250 ), maxSelected( 1 ) ), fontobj = lb = Col List Box() );
lb << Set Items( myitems );
lb << Get Items;
myend1 = Tick Seconds();
mystart2 = Tick Seconds();
nw2 = New Window( "Filter Col Selector Example", fontobj = lb = Filter Col Selector( width( 250 ) ) );
myend2 = Tick Seconds();
Close( dt1, nosave );
nw1 << close window;
nw2 << close window;
Code Explanation:
- Start timer.
- Open data table.
- Get column names.
- Create new window.
- Add column list box.
- Set list box items.
- Get selected items.
- Create another window.
- Add filter column selector.
- Close data table.
- Close windows.
- Define variables n, p.
- Create new data table.
- Start timer.
- Get column names.
- Create new window.
- Add column list box.
- Set list box items.
- Get selected items.
- End timer.
- Create another window.
- Add filter column selector.
- End timer.
- Close data table.
- Close windows.
- Redefine variables n, p.
- Create new data table.
- Start timer.
- Get column names.
- Create new window.
- Add column list box.
- Set list box items.
- Get selected items.
- End timer.
- Create another window.
- Add filter column selector.
- End timer.
- Close data table.
- Close windows.
Summary: Creates a new table from columns 1 to 2 in a data table, utilizing the As Table function.
Code:
dt = Open("data_table.jmp");
dt2 = As Table( 1 :: 2 );
Code Explanation:
- Open data table;
- Create new table from columns 1 to 2.