Subset
Example 1
Summary: Creates a subset from a data table, preserving original data links.
Code:
dt = Open("data_table.jmp");
mySubset = dt << Subset( All rows, Selected columns only( 0 ), link to original data table( 1 ) );
Code Explanation:
- Open data table.
- Create subset from table.
Example 2
Summary: Runs the selection and subset creation process for a specific set of rows in a data table, utilizing JMP's built-in functionality.
Code:
dt = Open("data_table.jmp");
dt << clear row states;
dt << select rows( [21, 22, 23, 24, 25, 26, 27, 28, 29, 30] );
mySubset = dt << subset( selected rows( 1 ), link to original data table( 1 ) );
Code Explanation:
- Open data table;
- Clear row states.
- Select specific rows.
- Create subset from selection.
Example 3
Summary: Subsets data by sex, selecting specific columns and linking to the original table.
Code:
dt = Open("data_table.jmp");
dt << Subset(
By( :sex ),
All rows,
Selected columns only( 0 ),
columns( :name, :age, :height, :weight ),
link to original data table( 1 )
);
Code Explanation:
- Open data table;
- Subset data by sex.
- Include all rows.
- Select specific columns.
- Link to original table.
Example 4
Summary: Creates a subset from a data table, linking the subset to the original data.
Code:
dt = Open("data_table.jmp");
dt << Subset(
Rows(
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]
),
link to original data table( 1 )
);
Code Explanation:
- Open data table;
- Create subset of rows.
- Link subset to original data.
Example 5
Summary: Subsets data by Report, selecting specific columns and linking the result to the original data table.
Code:
dt = Open("data_table.jmp");
dt << Subset(
By( :Report ),
All rows,
Selected columns only( 0 ),
columns( :Color, :Clarity, :Depth, :Table ),
link to original data table( 1 )
);
Code Explanation:
- Open data table;
- Subset data by Report.
- Include all rows.
- Exclude selected columns.
- Select Color, Clarity, Depth, Table.
- Link subset to original data table.
Example 6
Summary: Creates a subset from a data table, grouping by Species and selecting specific columns.
Code:
dt = Open("data_table.jmp");
dt << Subset(
Linked,
Suppress formula evaluation( 0 ),
By( :Species ),
All rows,
Selected columns only( 0 ),
columns( :Sepal width, :Petal width, :Petal length )
);
dt2 = Data Table("data_table");
Code Explanation:
- Open data table;
- Create subset linked.
- Suppress formula evaluation.
- Group by Species.
- Include all rows.
- Select specific columns.
- Store subset in dt2.
Example 7
Summary: Creates a subset data table from an original data table, filtering by sex and selecting specific columns.
Code:
dt = Open("data_table.jmp");
dt << Subset(
Linked,
Suppress formula evaluation( 0 ),
By( :sex ),
All rows,
Selected columns only( 0 ),
columns( :weight, :height, :age )
);
dt2 = Data Table("data_table");
Code Explanation:
- Open data table.
- Create subset linked to original.
- Suppress formula evaluation.
- Subset by sex.
- Include all rows.
- Exclude selected columns.
- Select weight, height, age columns.
- Name subset data table as dt2.
- Filter subset for sex=M.
Example 8
Summary: Subsets data by sex, selecting all rows and specific columns, while linking the subset to the original data table.
Code:
dt = Open("data_table.jmp");
dt << Subset(
By( :sex ),
All rows,
Selected columns only( 0 ),
columns( :name, :age, :height, :weight ),
link to original data table( 1 )
);
mySubset = Data Table("data_table");
Code Explanation:
- Open data table;
- Subset data by sex.
- Select all rows.
- Include specific columns.
- Link subset to original.
- Create new data table.
- Name new table "sex=F.jmp".
Example 9
Summary: Selects and subsets specific rows from a data table, clearing row states throughout the process.
Code:
dt = Open("data_table.jmp");
dt << Clear Row States;
dt << select rows(
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]
);
mySubset = subset( linked, dt );
mySubset << Clear Row States;
Code Explanation:
- Open data table;
- Clear row states.
- Select specific rows.
- Create subset of selected rows.
- Clear row states in subset.
Example 10
Summary: Selects and hides specific rows in a data table, based on region and row indices.
Code:
dt = Open("data_table.jmp");
dt << select where( :Region == "W" );
mySubset = dt << subset( linked, dt );
mySubset << clear row states;
mySubset << select rows( [1, 2] );
mySubset << hide;
Code Explanation:
- Open data table;
- Select Region == "W".
- Create linked subset.
- Clear row states.
- Select rows 1, 2.
- Hide selected rows.
Example 11
Summary: Runs the selection and subset creation process for a data table with specific region criteria, clearing row states in the resulting subset.
Code:
dt = Open("data_table.jmp");
dt << select where( :Region == "W" );
mySubset = dt << subset( linked, dt );
mySubset << clear row states;
Code Explanation:
- Open data table.
- Select rows where region is W.
- Create linked subset.
- Clear row states in subset.
Example 12
Summary: Creates and analyzes a subset from a data table, running a Bivariate analysis and saving the report to a temporary file.
Code:
dt = Open("data_table.jmp");
dtsubset = dt << Subset( Sampling Rate( 0.5 ), Link to Original Data Table( 1 ) );
biv = dtsubset << Run Script( "Bivariate" );
Report( biv ) << Save Window Report( "$TEMP/subsetplatform.jrp", embed data( 1 ) );
Report( biv ) << Close Window;
Close( dtsubset, "NoSave" );
Code Explanation:
- Open data table;
- Create subset with 50% sampling.
- Link subset to original data.
- Run Bivariate analysis on subset.
- Save report to temporary file.
- Embed data in saved report.
- Close Bivariate report window.
- Close subset data table without saving.
Example 13
Summary: Creates and analyzes a subset of data, linking it to the original table and generating a Bivariate report with embedded data.
Code:
dt = Open("data_table.jmp");
dtsubset = dt << Subset( Sampling Rate( 0.5 ), Link to Original Data Table( 1 ) );
biv = dtsubset << Run Script( "Bivariate" );
Report( biv ) << Save Window Report( "$TEMP/subsetplatform.jrp", embed data( 1 ) );
Report( biv ) << Close Window;
Close( dtsubset, "NoSave" );
Open( "$TEMP/subsetplatform.jrp" );
Code Explanation:
- Open data table;
- Create subset of 50% data.
- Link subset to original data.
- Run Bivariate analysis on subset.
- Save Bivariate report to temporary file.
- Embed data in saved report.
- Close Bivariate window.
- Close subset data table without saving.
- Open saved Bivariate report.
Example 14
Summary: Process of creating a subset of data, running Bivariate analysis, and saving the report to a temporary file with embedded data.
Code:
dt = Open("data_table.jmp");
dtsubset = dt << Subset( Sampling Rate( 0.5 ), Link to Original Data Table( 1 ) );
biv = dtsubset << Run Script( "Bivariate" );
Report( biv ) << Save Window Report( "$TEMP/subsetplatform.jrp", embed data( 1 ) );
Report( biv ) << Close Window;
Code Explanation:
- Open data table;
- Create subset with 50% sampling.
- Link subset to original data.
- Run Bivariate analysis on subset.
- Save report to temporary file.
- Embed data in saved report.
- Close Bivariate window.
Example 15
Summary: Subsets data and matrix conversion for analysis, utilizing JMP's data manipulation capabilities to extract column names and select specific rows.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", "private" );
tablelist = dt << Subset( By( :sex ), columns( :name, :age, :height, :weight ) );
colnames1 = Char( tablelist[1] << Get Column Names );
colnames2 = Char( tablelist[2] << Get Column Names );
m1 = tablelist[1] << get as matrix;
Close( tablelist[1], nosave );
Close( tablelist[2], nosave );
tablelist = dt << Subset( By( :age ), columns( :name, :height, :weight ) );
colnames3 = Char( tablelist[2] << Get Column Names );
m2 = tablelist[2] << get as matrix;
Close( tablelist[1], nosave );
Close( tablelist[2], nosave );
Close( tablelist[3], nosave );
Close( tablelist[4], nosave );
Close( tablelist[5], nosave );
Close( tablelist[6], nosave );
dt << Select Where( :sex == "F" & :age >= 15 );
dt2 = dt << Subset( Selected Rows );
m3 = dt2 << get all columns as matrix;
Code Explanation:
- Open data table;
- Subset data by sex.
- Extract column names for males.
- Extract column names for females.
- Convert male subset to matrix.
- Close male subset without saving.
- Close female subset without saving.
- Subset data by age.
- Extract column names for second subset.
- Convert second subset to matrix.
- Close all subsets without saving.
- Select rows where sex is female and age is 15 or older.
- Create new table from selected rows.
- Convert selected rows to matrix.
Example 16
Summary: Subsets data and value retrieval from a JMP data table, utilizing the Subset platform to create two output tables named 'Test' based on sex.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", "private" );
dt << Subset( By( :sex ), output table name( "Test" ), keep by columns );
sub1 = Data Table("data_table");
sub2 = Data Table("data_table");
Try( vals1 = Column( sub1, "sex" ) << get values );
Try( vals2 = Column( sub2, "sex" ) << get values );
Code Explanation:
- Open data table.
- Subset data by sex.
- Name output tables "Test".
- Assign subset tables to variables.
- Attempt to get values from sex column in Test 1.
- Attempt to get values from sex column in Test 2.
Example 17
Summary: Subsets data and selection operations to extract specific columns and filter by age, utilizing JMP's data manipulation capabilities.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", "private" );
dt << Subset( By( :sex ), output table name( "Test" ), keep by columns );
sub1 = Data Table("data_table");
sub2 = Data Table("data_table");
Try( vals1 = Column( sub1, "sex" ) << get values );
Try( vals2 = Column( sub2, "sex" ) << get values );
dt = Open( "$SAMPLE_DATA/data_table.jmp", "private" );
Column( "name" ) << set selected;
Column( "sex" ) << set selected;
Column( "height" ) << set selected;
Column( "weight" ) << set selected;
subdt = dt << Subset( Selected columns, By( :age ), Keep by columns );
For( i = 1, i <= N Items( subdt ), i++,
colname = Column( subdt[i], 1 ) << get name
);
Code Explanation:
- Open data table;
- Subset data by sex.
- Assign subsets to sub1 and sub2.
- Attempt to get values from sub1's sex column.
- Attempt to get values from sub2's sex column.
- Reopen "data_table.jmp".
- Select name, sex, height, weight columns.
- Subset data by selected columns and age.
- Loop through subset tables.
- Get first column's name.
Example 18
Summary: Creates a subset data table from an original data table, stratified by age, and converts it to a character matrix.
Code:
dt = Open("data_table.jmp");
subdt = dt << Subset( Copy formula( 0 ), Sample Size( 1 ), Stratify( :age ) );
m = Char( subdt << Get As Matrix( {age} ) );
Code Explanation:
- Open data table.
- Create subset data table.
- Copy formulas to subset.
- Set sample size to 1.
- Stratify subset by age.
- Convert subset to matrix.
- Extract age column from matrix.
- Convert matrix to character.
Example 19
Summary: Subsets data and summarization by age, calculating mean height and weight, with the summary results displayed invisibly or privately depending on the output table name.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", private );
subset1 = dt << Subset( Output Table Name( "Not Visible" ), invisible );
subset2 = dt << Subset( Output Table Name( "Totally Private" ), private );
sumDt1 = dt << Summary( Group( :age ), Mean( :height ), Mean( :weight ), invisible );
sumDt2 = dt << Summary( Group( :age ), Mean( :height ), Mean( :weight ), private );
Code Explanation:
- Open data table;
- Create subset 1 invisibly.
- Create subset 2 privately.
- Summarize data by age.
- Calculate mean height.
- Calculate mean weight.
- Display summary invisibly.
- Summarize data by age again.
- Calculate mean height again.
- Calculate mean weight again.
- Display summary privately.
Example 20
Summary: Subsets data and matrix conversion for analysis, utilizing JMP's data manipulation capabilities to extract column names and filter rows.
Code:
dt = Open("data_table.jmp");
tablelist = dt << Subset( By( :sex ), columns( :name, :age, :height, :weight ) );
colnames1 = Char( tablelist[1] << Get Column Names );
colnames2 = Char( tablelist[2] << Get Column Names );
m1 = tablelist[1] << get as matrix;
Close( tablelist[1], nosave );
Close( tablelist[2], nosave );
tablelist = dt << Subset( By( :age ), columns( :name, :height, :weight ) );
colnames3 = Char( tablelist[2] << Get Column Names );
m2 = tablelist[2] << get as matrix;
Close( tablelist[1], nosave );
Close( tablelist[2], nosave );
Close( tablelist[3], nosave );
Close( tablelist[4], nosave );
Close( tablelist[5], nosave );
Close( tablelist[6], nosave );
dt << Select Where( :sex == "F" & :age >= 15 );
dt2 = dt << Subset( Selected Rows );
m3 = dt2 << get all columns as matrix;
Code Explanation:
- Open data_table data
- Subset data by sex.
- Extract column names for males.
- Extract column names for females.
- Convert male subset to matrix.
- Close male subset without saving.
- Close female subset without saving.
- Subset data by age.
- Extract column names for second age group.
- Convert second age group subset to matrix.
- Close all subsets without saving.
- Select rows where sex is female and age is 15 or older.
- Create subset of selected rows.
- Convert selected subset to matrix.
Example 21
Summary: Subsets data and value retrieval from a JMP data table, utilizing the Subset platform to create two separate subsets based on the sex column.
Code:
dt = Open("data_table.jmp");
dt << Subset( By( :sex ), output table name( "Test" ), keep by columns );
sub1 = Data Table("data_table");
sub2 = Data Table("data_table");
Try( vals1 = Column( sub1, "sex" ) << get values );
Try( vals2 = Column( sub2, "sex" ) << get values );
Close( dt, nosave );
Code Explanation:
- Open data table.
- Subset by sex column.
- Output named "Test".
- Assign subset 1 to sub1.
- Assign subset 2 to sub2.
- Try getting values from sub1's sex column.
- Try getting values from sub2's sex column.
- Close original data table without saving.
Example 22
Summary: Subsets data and column extraction from a JMP data table, utilizing the Subset platform to filter by sex and select specific columns.
Code:
dt = Open("data_table.jmp");
tablelist = dt << Subset( By( :sex ), columns( :name, :age, :height, :weight ) );
colnames1 = Char( tablelist[1] << Get Column Names );
colnames2 = Char( tablelist[2] << Get Column Names );
m1 = tablelist[1] << get as matrix;
Code Explanation:
- Open data table;
- Subset data by sex.
- Select specific columns.
- Store subset tables in list.
- Extract column names from first subset.
- Extract column names from second subset.
- Convert first subset to matrix.
Example 23
Summary: Subsets data and value retrieval from a JMP data table, utilizing the Subset platform to filter by sex and keep columns.
Code:
dt = Open("data_table.jmp");
dt << Subset( By( :sex ), output table name( "Test" ), keep by columns );
sub1 = Data Table("data_table");
sub2 = Data Table("data_table");
Try( vals1 = Column( sub1, "sex" ) << get values );
Try( vals2 = Column( sub2, "sex" ) << get values );
Code Explanation:
- Open data table;
- Subset by sex.
- Output named "Test".
- Keep by columns.
- Assign Test 1 to sub1.
- Assign Test 2 to sub2.
- Try to get sex values from sub1.
- Try to get sex values from sub2.
Example 24
Summary: Runs data table operations by opening a file, clearing column and row selections, and subsetting selected columns to create a new data table.
Code:
dt1 = Open("data_table.jmp");
dt1 << Clear Column Selection;
dt1 << Clear Select;
dt2 = dt1 << subset( columns( dt1 << get selected columns ) );
Code Explanation:
- Open data table;
- Clear column selection.
- Clear row selection.
- Subset selected columns.
- Assign subset to dt2.
Example 25
Summary: Selects and subsets columns in a data table, creating a new table with the desired columns.
Code:
dt1 = Open("data_table.jmp");
dt2 = dt1 << subset( columns( dt1 << get selected columns ) );
Code Explanation:
- Open data table.
- Select columns in data table.
- Subset selected columns into new table.
Example 26
Summary: Creates a subset from a data table by filtering rows based on specific conditions, including Type, Grade, and Site.
Code:
dt = Open("data_table.jmp");
subsetdt = dt << Subset(
Filtered Rows(
(:Type == "Viable" & :Grade == "C" & :Site == "Room282") | (:Type == "Surface" & :Grade == "D" & :Site == "Room151") | (:Type ==
"Viable" & :Grade == "C" & :Site == "Room125")
)
);
Code Explanation:
- Open data table.
- Create subset of data.
- Filter rows by conditions.
- Type is Viable, Grade C, Site Room282.
- Or Type is Surface, Grade D, Site Room151.
- Or Type is Viable, Grade C, Site Room125.
Example 27
Summary: Creates and compares two ARIMA models for Steel Shipments data, utilizing random selection and exclusion to simulate real-world scenarios.
Code:
dt = Open("data_table.jmp");
dt2 = dt << Subset( All Rows( 1 ), All Columns( 1 ) );
Random Reset( 123456789 );
dt << Select Randomly( 0.1 ) << Hide and Exclude();
dt << Clear Select;
Random Reset( 123 );
obj = dt << Time Series( Y( :Steel Shipments ) );
Random Reset( 456 );
obj << Maximum Iterations( 2 );
Random Reset( 789 );
obj << ARIMA( 1, 0, 0 );
Random Reset( 123 );
obj2 = dt2 << Time Series( Y( :Steel Shipments ) );
Random Reset( 456 );
obj2 << Maximum Iterations( 2 );
Random Reset( 789 );
obj2 << ARIMA( 1, 0, 0 );
obj2 << Automatic Recalc( 1 );
Random Reset( 123456789 );
dt2 << Select Randomly( 0.1 ) << Hide and Exclude();
dt2 << Clear Select;
rpt1 = obj << report;
rpt2 = obj2 << report;
mc1 = rpt1["Model Comparison"][Table Box( 1 )] << get as matrix;
mc2 = rpt2["Model Comparison"][Table Box( 1 )] << get as matrix;
Code Explanation:
- Open data table.
- Create subset of data.
- Set random seed.
- Randomly select and hide rows.
- Clear row selection.
- Set new random seed.
- Create time series object.
- Set maximum iterations.
- Set ARIMA model parameters.
- Create second time series object.
Subset using Triangulation
Example 1
Summary: Vizualizes triangulation results by generating a contour segment graph with shape segments, utilizing JMP's Triangulation and Graph Box features.
Code:
Open("data_table.jmp");
tri = Triangulation( X( :X, :Y ), Y( :POP ) );
tri = tri << Subset( tri << Get Hull Points );
{xx, yy} = tri << Get Points();
New Window( "Contour Seg Example",
g = Graph Box(
X Scale( Min( xx ) - .1, Max( xx ) + .1 ),
Y Scale( Min( yy ) - .1, Max( yy ) + .1 ),
Contour Seg( tri, [0, 400, 1000, 2000, 9000], zColor( 5 + [64 32 0 16 48] ), Transparency( [1, 1, 1, 1, 1] ) ),
Shape Seg( {Path( tri << Get Hull Path() )}, <<Set Color( "Black" ) )
)
);
frame = g[FrameBox( 1 )];
Code Explanation:
- Open data table.
- Perform triangulation.
- Subset triangulation hull points.
- Retrieve triangulation points.
- Create new window.
- Initialize graph box.
- Set X scale.
- Set Y scale.
- Add contour segments.
- Add shape segments.
Example 2
Summary: Creates a contour segment graph from triangulation data, with interactive features for exploring hull points and shape segments.
Code:
dt = Open("data_table.jmp");
tri = Triangulation( X( :X, :Y ), Y( :POP ) );
tri = tri << Subset( tri << Get Hull Points );
{xx, yy} = tri << Get Points();
New Window( "Contour Seg Example",
g = Graph Box(
X Scale( Min( xx ) - .1, Max( xx ) + .1 ),
Y Scale( Min( yy ) - .1, Max( yy ) + .1 ),
Contour Seg( tri, [0, 400, 1000, 2000, 9000], zColor( 5 + [64 32 0 16 48] ), Transparency( [1, 1, 1, 1, 1] ) ),
Shape Seg( {Path( tri << Get Hull Path() )}, <<Set Color( "Black" ) )
)
);
frame = g[FrameBox( 1 )];
seg = (frame << Find Seg( Contour Seg( 1 ) ));
Code Explanation:
- Open data table.
- Perform triangulation.
- Subset triangulation hull points.
- Retrieve triangulation points.
- Create new window.
- Set graph box scales.
- Add contour segments.
- Add shape segments.
- Access graph frame.
- Find contour segment.
Subset using Get Rows Where
Summary: Selects and subsets a data table, utilizing the Get Rows Where and Subset functions to generate a specific output.
Code:
dt = Open("data_table.jmp");
dt << Get Rows Where();
For( i = 1, i <= 40, i += 2,
Selected( Row State( i ) ) = 1
);
dt << Subset( Output Table( "BigClassSubset" ), Selected Rows( 1 ), selected
columns( 0 ), Link to original data table( 1 ) );
dt << Clear Select;
Code Explanation:
- Open data_table data
- Get all row indices.
- Loop through rows 1 to 40.
- Select every other row.
- Create subset named "BigClassSubset".
- Include only selected rows.
- Exclude columns from subset.
- Link subset to original data.
- Clear selection in original data.
Subset using Data Table
Example 1
Summary: Creates a linked subset from the original data table, grouping by sex and selecting specific columns.
Code:
Open("data_table.jmp");
Data Table("data_table") << Subset(
Output Table( "Linked Subset" ),
Linked,
Suppress formula evaluation( 0 ),
By( :sex ),
All rows,
Selected columns only( 0 ),
columns( :name, :age, :height, :weight )
);
Code Explanation:
- Open data table;
- Create subset table.
- Link subset to original.
- Suppress formula evaluation.
- Group by sex.
- Include all rows.
- Select specified columns.
- Name subset "Linked Subset".
- Include name column.
- Include age column.
- Include height column.
- Include weight column.
Example 2
Summary: Creates a subset from a data table, specifying a copy formula and sampling rate.
Code:
dt = Open("data_table.jmp");
subDt1 = dt << Data Table("data_table") << Subset( Copy formula( 0 ), Sampling Rate( 0.5 ) );
sourceScript1 = Char( subDt1 << get property( "Source" ) );
Code Explanation:
- Open data_table data
- Create subset of "data_table" table.
- Set copy formula option to off.
- Use sampling rate of 50%.
- Retrieve source script of subset.
- Convert source script to character.
Subset using Select where
Summary: Data filtering and subsetting to extract specific rows from a data table, linking the subset back to the original data.
Code:
dt = Open("data_table.jmp");
dt << Select where( :Report == "AGS" );
dt2 = dt << Subset( Selected Rows, link to original data table( 1 ) );
dt2 << Clear Selected Row States;
Code Explanation:
- Open data table;
- Select rows with Report == "AGS".
- Subset selected rows into dt2.
- Link subset to original data table.
- Clear selected row states in dt2.
Subset using Select Where
Example 1
Summary: Selects and subsets data table rows based on a specific species, linking the subset to the original table while clearing row states.
Code:
dt = Open("data_table.jmp");
dt << Select Where( :Species == "versicolor" );
dt2 = dt << Subset( Selected Rows, link to original data table( 1 ) );
dt2 << Clear Row States;
Code Explanation:
- Open data table;
- Select versicolor rows.
- Create subset of selected rows.
- Link subset to original table.
- Clear row states in subset.
Example 2
Summary: Data filtering and subsetting by opening a data table, selecting rows where height is less than 63, and creating a subset of the selected rows.
Code:
dt = Open("data_table.jmp");
dt << Select Where( :height < 63 );
dt2 = dt << Subset( Selected Rows );
Code Explanation:
- Open data table.
- Select rows where height is less than 63.
- Create subset of selected rows.
Subset using Char
Summary: Runs data table operations, including opening a file, converting tables to strings, and subsetting specific columns.
Code:
dt = Open("data_table.jmp");
dt1 = Char( dt );
cdt = Current Data Table();
test1 = Char( cdt );
subdt = dt << Subset( columns( :name, :age, :height, :weight ) );
dt2 = Char( subdt );
cdt = Current Data Table();
test2 = Char( cdt );
Code Explanation:
- Open data table.
- Convert table to string.
- Get current data table.
- Convert current table to string.
- Subset specific columns.
- Convert subset table to string.
- Get current data table again.
- Convert current table to string.
Subset using Column
Example 1
Summary: Process of selecting columns, creating a subset by age, and retrieving column names from each table.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", "private" );
Column( "name" ) << set selected;
Column( "sex" ) << set selected;
Column( "height" ) << set selected;
Column( "weight" ) << set selected;
subdt = dt << Subset( Selected columns, By( :age ), Keep by columns );
For( i = 1, i <= N Items( subdt ), i++,
colname = Column( subdt[i], 1 ) << get name
);
Code Explanation:
- Open data table.
- Set columns selected.
- Create subset by age.
- Loop through subset tables.
- Get column name from each table.
Example 2
Summary: Runs the selection and subset operation of a data table, allowing for targeted analysis of specific columns and rows.
Code:
dt = Open("data_table.jmp");
Column( dt, 2 ) << set selected;
Column( dt, "weight" ) << set selected;
dt << select rows( [1, 3, 5, 12, 27] );
subdt = dt << subset( selected columns( 1 ), selected rows( 0 ), output tablename( "Sub selected cols, All rows" ) );
Code Explanation:
- Open table.
- Select second column.
- Select weight column.
- Select specific rows.
- Subset selected columns.
- Output subset table.
Example 3
Summary: Selects and subsets columns in a JMP data table, based on age groups, and retrieves column names for further analysis.
Code:
dt = Open("data_table.jmp");
Column( "name" ) << set selected;
Column( "sex" ) << set selected;
Column( "height" ) << set selected;
Column( "weight" ) << set selected;
subdt = dt << Subset( Selected columns, By( :age ), Keep by columns );
For( i = 1, i <= N Items( subdt ), i++,
colname = Column( subdt[i], 1 ) << get name
);
Close( "age=17", nosave );
Close( "age=16", nosave );
Close( "age=15", nosave );
Close( "age=14", nosave );
Close( "age=13", nosave );
Code Explanation:
- Open data table;
- Select name column.
- Select sex column.
- Select height column.
- Select weight column.
- Subset selected columns by age.
- Loop through subsetted tables.
- Get first column name.
- Close age=17 table without saving.
- Close age=16 table without saving.
- Close age=15 table without saving.
- Close age=14 table without saving.
- Close age=13 table without saving.
Example 4
Summary: Selects and subsets rows and columns in a data table, allowing for focused analysis.
Code:
dt = Open("data_table.jmp");
dt << select rows( [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] );
Column( dt, 1 ) << Set Selected;
Column( dt, 2 ) << Set Selected;
Column( dt, 3 ) << Set Selected;
subDt = dt << Subset( Selected Rows( 1 ), Selected columns only( 0 ) );
Code Explanation:
- Open data table;
- Select rows 1-10.
- Select column 1.
- Select column 2.
- Select column 3.
- Subset selected rows.
- Include all columns in subset.
Example 5
Summary: Runs the selection and subset creation process for a data table, allowing for interactive exploration of relationships between columns.
Code:
dt = Open("data_table.jmp");
Column( "name" ) << set selected;
Column( "sex" ) << set selected;
Column( "height" ) << set selected;
Column( "weight" ) << set selected;
subdt = dt << Subset( Selected columns, By( :age ), Keep by columns );
For( i = 1, i <= N Items( subdt ), i++,
colname = Column( subdt[i], 1 ) << get name
);
Code Explanation:
- Open table.
- Select columns.
- Create subset.
- Loop through subsets.
- Get column name.
Subset using Select Rows
Example 1
Summary: Runs the selection and journaling of specific rows from a data table, saving the output as an HTML file.
Code:
dt1 = Open("data_table.jmp");
dt1 << Select Rows( [1, 3, 6, 7] );
newdt = dt1 << Subset( Selected Rows( 0 ), Rows( [1, 3, 6, 7] ), Selected columns only( 0 ) );
jrn = newdt << Journal();
Current Journal() << Save HTML( "$TEMP/BigClassFamJournal.html", "jpeg" );
Code Explanation:
- Open data table;
- Select specific rows.
- Create subset of selected rows.
- Generate journal from subset.
- Save journal as HTML.
Example 2
Summary: Selects and subsets data rows, followed by journaling and saving as HTML.
Code:
dt = Open("data_table.jmp");
dt << Select Rows( [1, 3, 6, 7] );
newdt = dt << Subset( Selected Rows( 0 ), Rows( [1, 3, 6, 7] ), Selected columns only( 0 ) );
newdt << Journal();
Current Journal() << Save HTML( "$TEMP/BigClassFamJournal.html", PNG );
Code Explanation:
- Open data table;
- Select rows 1, 3, 6, 7.
- Create subset of selected rows.
- Open journal for subset.
- Save journal as HTML.
Example 3
Summary: Runs data manipulation and filtering tasks, including row selection, exclusion, and subset creation, as well as adding a new column with row states.
Code:
dt = Open("data_table.jmp");
dt << Select Rows( [3, 5, 9, 12] );
dt << Exclude( 1 );
dt << Select All Rows;
Column( 1 ) << Set Selected;
Column( 2 ) << Set Selected;
subDt = dt << Subset( All Rows( 1 ), Selected Columns( 1 ), Linked( 1 ) );
subDt << Clear select();
subDt << Select Rows( [3, 4, 5, 6] );
col1 = dt << New Column( "RS", rowstate );
Column( dt, "RS" ) << Add From Row States;
col2 = subDt << New Column( "RS", rowstate );
Column( subDt, "RS" ) << Add From Row States;
Close( subDt, nosave );
Close( dt, nosave );
dt = New Table( "base", New Column( "label", Set Values( 1 :: 10 ) ) );
set = Random Shuffle( 1 :: N Rows( dt ) );
split = Floor( N Rows( dt ) * .5 );
set1 = set[1 :: split];
set2 = set[(split + 1) :: N Rows( dt )];
dt1 = dt << subset( rows( set1 ), LinkToOriginalDataTable( 1 ) );
dt2 = dt << subset( rows( set2 ), LinkToOriginalDataTable( 1 ) );
dt << selectwhere( 3 < :label < 8 );
dt << deleterows;
vals = dt << get as Matrix;
Code Explanation:
- Open data table;
- Select specific rows.
- Exclude first row.
- Select all rows.
- Select columns 1 and 2.
- Create subset of selected rows and columns.
- Clear selection in subset table.
- Select specific rows in subset table.
- Add row state column to original table.
- Add row state from original to subset table.
- Close subset table without saving.
- Close original table without saving.
- Create new table "base".
- Add "label" column with values 1-10.
- Randomly shuffle row indices.
- Split indices into two sets.
- Create subset tables based on shuffled indices.
- Select rows where label is between 3 and 8.
- Delete selected rows.
- Get remaining data as matrix.
Example 4
Summary: Selects data and subset creation, adding row state columns to both the original table and a subset table.
Code:
dt = Open("data_table.jmp");
dt << Select Rows( [3, 5, 9, 12] );
dt << Exclude( 1 );
dt << Select All Rows;
Column( 1 ) << Set Selected;
Column( 2 ) << Set Selected;
subDt = dt << Subset( All Rows( 1 ), Selected Columns( 1 ), Linked( 1 ) );
subDt << Clear select();
subDt << Select Rows( [3, 4, 5, 6] );
col1 = dt << New Column( "RS", rowstate );
Column( dt, "RS" ) << Add From Row States;
col2 = subDt << New Column( "RS", rowstate );
Column( subDt, "RS" ) << Add From Row States;
Code Explanation:
- Open data table;
- Select rows 3, 5, 9, 12.
- Exclude first row.
- Select all rows.
- Select column 1.
- Select column 2.
- Create subset table.
- Clear selection in subset.
- Select rows 3, 4, 5, 6 in subset.
- Add row state column to original table.
- Add row states to new column in original table.
- Add row state column to subset table.
- Add row states to new column in subset table.
Subset using Clear column selection
Summary: Runs data table operations by opening a file, clearing column selection, creating a subset table, renaming the output table, and setting the current data table.
Code:
dt = Open("data_table.jmp");
dt << Clear column selection();
dt2 = dt << Subset( Output table name( "Concat to data_table" ) );
Current Data Table();
Code Explanation:
- Open data table.
- Clear column selection.
- Create subset table.
- Rename output table.
- Set current data table.
Subset using Function
Example 1
Summary: Filters a data table by creating a new window with a filter column selector and subsets the data based on user selection.
Code:
dt = Open("data_table.jmp");
f = Function( {dt},
{ns},
ns = New Namespace();
ns:sub = dt << Subset(
Output Table( "sub" ),
Selected Rows( 0 ),
Rows( [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22] ),
Selected columns only( 0 )
);
ns;
);
gns = f( dt );
New Window( "Filter Col Selector Example",
fontobj = lb1 = Filter Col Selector(
width( 250 ),
On Change(
Close( gns:sub, nosave );
gns = f( dt );
)
)
);
lb1 << set selected( :age );
lb1 << close window;
Code Explanation:
- Open data table.
- Define function
fwith parameters. - Create new namespace
ns. - Subset rows 6-22 from data table.
- Assign subset to
ns:sub. - Call function
fwith data table. - Create new window for filter selector.
- Add filter column selector to window.
- Set selected column to
:age. - Close filter selector window.
Example 2
Summary: Filters and subsets a data table based on user selection, utilizing a Filter Col Selector to interactively select columns.
Code:
dt2 = Open("data_table.jmp");
f = Function( {dt2},
sub = dt2 << Subset(
Output Table( "sub" ),
Selected Rows( 0 ),
Rows( [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22] ),
Selected columns only( 0 )
)
);
f( dt2 );
win = New Window( "Filter Col Selector Example",
fontobj = lb2 = Filter Col Selector(
width( 250 ),
On Change(
sub:age << set selected;
sub:weight << set selected;
sub << delete columns();
)
)
);
lb2 << set selected( :weight );
cols = sub << get selected columns;
lb2 << close window;
Code Explanation:
- Open data table;
- Define function
ffor subsetting. - Call function
fon dataset. - Create new window for column selector.
- Add Filter Col Selector to window.
- Set initial selection to weight column.
- Get selected columns from subset.
- Close the column selector window.
Example 3
Summary: Creates a subset table from an original data table, utilizing a custom function and namespace.
Code:
dt = Open("data_table.jmp");
f = Function( {dt},
{ns},
ns = New Namespace();
ns:sub = dt << Subset(
Output Table( "sub" ),
Selected Rows( 0 ),
Rows( [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22] ),
Selected columns only( 0 )
);
ns;
);
gns = f( dt );
Code Explanation:
- Open table.
- Define function.
- Create namespace.
- Subset rows.
- Output subset table.
- Execute function.
- Assign result to variable.
Subset using Set Name
Example 1
Summary: Subsets data and file closing operations in JMP, utilizing the
Subsetfunction to create two subsets based on species and subject columns.
Code:
dt = Open("data_table.jmp");
dt << select columns( :Species );
dt:Species << Set Name( "Species>" );
dt << Exclude( 1 );
dt:subject << Set Name( "Subject<" );
subDt1 = dt << Subset( By( :Name( "Species>" ) ), All rows, Selected columns only( 0 ), columns( :Name( "Subject<" ), :miles, :season ) );
subDt2 = dt << Subset( By( :Name( "Subject<" ) ), All rows, Selected columns only( 0 ), columns( :Name( "Species>" ), :miles, :season ) );
If( Host is( "windows" ),
Close( "Subject-=1", nosave ),
Close( "Subject-=1.jmp", nosave )
);
If( Host is( "windows" ),
Close( "Subject-=2", nosave ),
Close( "Subject-=2.jmp", nosave )
);
If( Host is( "windows" ),
Close( "Subject-=3", nosave ),
Close( "Subject-=3.jmp", nosave )
);
If( Host is( "windows" ),
Close( "Species-=FOX", nosave ),
Close( "Species-=FOX.jmp", nosave )
);
If( Host is( "windows" ),
Close( "Species-=COYOTE", nosave ),
Close( "Species-=COYOTE.jmp", nosave )
);
Close( dt, nosave );
Code Explanation:
- Open data table;
- Select Species column.
- Rename Species column.
- Exclude first row.
- Rename subject column.
- Create subset subDt1 by Species.
- Create subset subDt2 by Subject.
- Close "Subject-=1" file if Windows.
- Close "Subject-=2" file if Windows.
- Close "Subject-=3" file if Windows.
- Close "Species-=FOX" file if Windows.
- Close "Species-=COYOTE" file if Windows.
- Close original dataset without saving.
Example 2
Summary: Runs data table operations, including column renaming, subset creation, and file closing, on a Windows platform.
Code:
dt = Open("data_table.jmp");
dt << select columns( :Species );
dt:Species << Set Name( "Species/" );
dt << Exclude( 1 );
dt:subject << Set Name( "Subject*" );
subDt1 = dt << Subset( By( :Name( "Species/" ) ), All rows, Selected columns only( 0 ), columns( :Name( "Subject*" ), :miles, :season ) );
subDt2 = dt << Subset( By( :Name( "Subject*" ) ), All rows, Selected columns only( 0 ), columns( :Name( "Species/" ), :miles, :season ) );
If( Host is( "windows" ),
Close( "Subject-=1", nosave ),
Close( "Subject-=1.jmp", nosave )
);
If( Host is( "windows" ),
Close( "Subject-=2", nosave ),
Close( "Subject-=2.jmp", nosave )
);
If( Host is( "windows" ),
Close( "Subject-=3", nosave ),
Close( "Subject-=3.jmp", nosave )
);
If( Host is( "windows" ),
Close( "Species-=FOX", nosave ),
Close( "Species-=FOX", nosave )
);
If( Host is( "windows" ),
Close( "Species-=COYOTE", nosave ),
Close( "Species-=COYOTE", nosave )
);
Close( dt, nosave );
Code Explanation:
- Open data table.
- Select Species column.
- Rename Species column to "Species/".
- Exclude first row.
- Rename subject column to "Subject*".
- Create subset subDt1 by Species.
- Create subset subDt2 by Subject.
- Close "Subject-=1" or "Subject-=1.jmp" if Windows.
- Close "Subject-=2" or "Subject-=2.jmp" if Windows.
- Close "Subject-=3" or "Subject-=3.jmp" if Windows.
- Close "Species-=FOX" if Windows.
- Close "Species-=COYOTE" if Windows.
- Close original data table without saving.
Example 3
Summary: Subsets data and renaming operations on a JMP data table, utilizing the Subset platform to create two subsets based on species and subject variables.
Code:
dt = Open("data_table.jmp");
dt << select columns( :Species );
dt:Species << Set Name( "Species>" );
dt << Exclude( 1 );
dt:subject << Set Name( "Subject<" );
subDt1 = dt << Subset( By( :Name( "Species>" ) ), All rows, Selected columns only( 0 ), columns( :Name( "Subject<" ), :miles, :season ) );
subDt2 = dt << Subset( By( :Name( "Subject<" ) ), All rows, Selected columns only( 0 ), columns( :Name( "Species>" ), :miles, :season ) );
Code Explanation:
- Open data table.
- Select Species column.
- Rename Species column.
- Exclude first row.
- Rename subject column.
- Create subset by Species.
- Create subset by Subject.
- End script.
Example 4
Summary: Prepares data by selecting, renaming, and subsetting a JMP data table to create two subsets based on species and subject.
Code:
dt = Open("data_table.jmp");
dt << select columns( :Species );
dt:Species << Set Name( "Species/" );
dt << Exclude( 1 );
dt:subject << Set Name( "Subject*" );
subDt1 = dt << Subset( By( :Name( "Species/" ) ), All rows, Selected columns only( 0 ), columns( :Name( "Subject*" ), :miles, :season ) );
subDt2 = dt << Subset( By( :Name( "Subject*" ) ), All rows, Selected columns only( 0 ), columns( :Name( "Species/" ), :miles, :season ) );
Code Explanation:
- Open data table.
- Select Species column.
- Rename Species column.
- Exclude first row.
- Rename subject column.
- Subset data by Species.
- Subset data by Subject.
- Save subDt1 subset.
- Save subDt2 subset.
- End script.
Example 5
Summary: Subsets data and renaming operations to prepare a JMP data table for analysis, utilizing the
Open,Select,Set Name,Exclude, andSubsetfunctions.
Code:
dt = Open("data_table.jmp");
dt << select columns( :Species );
dt:Species << Set Name( "Species\!"" );
dt << Exclude( 1 );
dt:subject << Set Name( "Subject|" );
subDt1 = dt << Subset( By( :Name( "Species\!"" ) ), All rows, Selected columns only( 0 ), columns( :Name( "Subject|" ), :miles, :season ) );
subDt2 = dt << Subset( By( :Name( "Subject|" ) ), All rows, Selected columns only( 0 ), columns( :Name( "Species\!"" ), :miles, :season ) );
Code Explanation:
- Open data table.
- Select Species column.
- Rename Species column to "Species!".
- Exclude first row.
- Rename subject column to "Subject|".
- Subset data by Species!.
- Create subDt1 with selected columns.
- Subset data by Subject|.
- Create subDt2 with selected columns.
Subset using Row Selection
Summary: Selects and subsets data rows based on a date condition, utilizing a dialog for interactive row selection.
Code:
dt4 = Open("data_table.jmp");
dt4 << Row Selection(
Select where( :Date > "12/22/2011"n | :Date > "12/05/2011"n ),
Dialog( Edit( Greater( Source Column( :Date ) ) ), Keep dialog open( 0 ) )
);
newDt4 = dt4 << Subset( selected rows );
matrix3 = newDt4 << get as matrix;
Code Explanation:
- Open data table;
- Select rows where Date > "12/22/2011" or Date > "12/05/2011".
- Show dialog for row selection.
- Create subset of selected rows.
- Convert subset to matrix.
Subset using For Each Row
Summary: Selects and subsets female rows from a data table, extracting the sex column as a matrix.
Code:
dt = Open("data_table.jmp");
For Each Row( Selected( Row State() ) = (:sex == "F") );
dt2 = dt << Subset( Output Table Name( "out1" ) );
m = dt2:sex << Get As Matrix();
Code Explanation:
- Open data table.
- Select female rows.
- Create subset table.
- Assign subset to variable.
- Extract sex column.
- Convert to matrix.
Subset using Select Duplicate Rows
Summary: Process of selecting duplicate rows from a data table, creating a subset of duplicates, and counting the number of rows in the subset.
Code:
dt2 = Open("data_table.jmp");
dt2 << Select Duplicate Rows( Match() );
dtSub = dt2 << Select Duplicate Rows( Match() ) << Subset( Selected Rows( 1 ), Selected columns only( 0 ) );
numRowsSubset = N Rows( dtSub );
Code Explanation:
- Open data table.
- Select duplicate rows.
- Create subset of duplicates.
- Count rows in subset.
Subset using Data Filter
Summary: Data filtering and subsetting for a specific age range, height threshold, and reported illnesses containing 'head', utilizing the Data Filter and Subset functions in JMP.
Code:
dt2 = Open("data_table.jmp");
df = dt2 << Data Filter(
Add Filter(
columns( :age, :height, :reported illnesses ),
Unstructured Text( Column( :reported illnesses ), Add Filter Text( "head" ) ),
Where( :age == {12, 13, 14, 15, 16} ),
Where( :height >= 55.298 ),
Match Any( Where( Contains( :reported illnesses, "head" ) ) ),
Display( :age, N Items( 6 ) ),
Display( :reported illnesses, N Items( 2 ) )
)
);
subdt2 = Data Table("data_table") << Subset(
Rows(
Data Table("data_table") << Get Rows Where(
(:age == 12 | :age == 13 | :age == 14 | :age == 15 | :age == 16) & :height >= 55.298 & Contains(
Lowercase( :reported illnesses ),
"head"
)
)
)
);
Code Explanation:
- Open table "data_table".
- Create data filter.
- Add filter for age, height, and reported illnesses.
- Set filter for age in specific range.
- Set filter for height greater than 55.298.
- Match any rows containing "head" in reported illnesses.
- Display filtered age count.
- Display filtered reported illnesses count.
- Subset data table based on filter criteria.
- Get rows where age is 12-16, height >= 55.298, and "head" in reported illnesses.
Subset using New Column
Summary: Creates a subset table with suppressed formula based on age criteria, adding a new numeric column for Upper Weight.
Code:
dt = Open("data_table.jmp");
dt << New Column( "Upper Weight", numeric, continuous, Formula( 256 ) );
dt << Select where( :age == 12 | :age == 13 );
subDt = dt << Subset( Output Table Name( "With Suppressed Formula" ) );
Code Explanation:
- Open data table;
- Add new column "Upper Weight".
- Set column type to numeric.
- Set column modeling type to continuous.
- Define formula for "Upper Weight".
- Select rows where age is 12 or 13.
- Create subset of selected rows.
- Save subset as "With Suppressed Formula".
Subset using Year
Summary: Data filtering and transformation by opening a data table, selecting rows based on year, hiding and excluding selected rows, creating a new column for the year, and subsetting the table by the transformed year.
Code:
dt1 = Open("data_table.jmp");
dt1 << select where( Year( :date ) >= 1957 );
dt1 << Hide and exclude;
dt1 << New Column( "yr", numeric, Formula( Year( :date ) ) );
dt2 = dt1 << Subset( By( Transform Column( "Year", Formula( Year( :date ) ) ) ), All rows, Selected columns only( 0 ) );
dt3 = dt1 << Subset( By( :yr ), All rows, Selected columns only( 0 ) );
Code Explanation:
- Open data table.
- Select rows with year >= 1957.
- Hide and exclude selected rows.
- Create new column "yr".
- Transform "yr" using year formula.
- Subset table by transformed year.
- Subset table by "yr" column.
- Assign subset to dt2.
- Assign subset to dt3.
Subset using Subscribe
Example 1
Summary: Runs data processing and saving operations in JMP, including subscribing to events, creating subsets, generating summaries, and unsubscribing from events.
Code:
savedList = {};
dtmain = Open("data_table.jmp");
dtmain << Subscribe(
"name5"("client"),
On Save(
Wait( 1 );
Insert Into( savedList, Word( 1, Current Data Table() << get name, "." ) );
)
);
dtmain << Save( "$DOCUMENTS/data_tableTest.jmp" );
subDt = dtmain << Subset( Selected Rows( 0 ), Linked, Rows( [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] ) );
subdt << Save( "$DOCUMENTS/subsetTable.jmp" );
subdt << Save( "$DOCUMENTS/subsetTable.jmp" );
sumDt = dtmain << Summary( Group( :Sex ), Mean( :Runtime ), Mean( :RunPulse ), Mean( :RstPulse ), output table name( "Summary" ) );
sumDt << Save( "$DOCUMENTS/summaryTable.jmp" );
Set Default Directory( "$TEMP" );
Try( dtmain << unsubscribe( "name5", all ) );
Try( subdt << unsubscribe( "name5", all ) );
Try( sumdt << unsubscribe( "name5", all ) );
Code Explanation:
- Initialize an empty list.
- Open data table;
- Subscribe to "name5" event.
- On save, wait 1 second.
- Insert table name into list.
- Save data_table.jmp to Documents.
- Create subset of rows.
- Save subset to Documents.
- Save subset again (redundant).
- Create summary table by sex.
- Save summary table to Documents.
- Set default directory to TEMP.
- Unsubscribe from "name5" for main table.
- Unsubscribe from "name5" for subset table.
- Unsubscribe from "name5" for summary table.
Example 2
Summary: Runs data processing by opening a data table, creating a subset of rows, and generating summary statistics grouped by Sex.
Code:
dtmain = Open("data_table.jmp");
savedList = {};
dtmain << Subscribe(
"name5"("client"),
On Save(
Wait( 1 );
Insert Into( savedList, Word( 1, Current Data Table() << get name, "." ) );
)
);
subDt = dtmain << Subset( Selected Rows( 0 ), Linked, Rows( [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] ) );
sumDt = dtmain << Summary( Group( :Sex ), Mean( :Runtime ), Mean( :RunPulse ), Mean( :RstPulse ), output table name( "Summary" ) );
Code Explanation:
- Open data table;
- Initialize empty list.
- Subscribe to "name5" event.
- On save, wait 1 second.
- Insert table name into list.
- Create subset of first 12 rows.
- Create summary table.
- Group by Sex.
- Calculate mean Runtime.
- Calculate mean RunPulse.
- Calculate mean RstPulse.
- Name output table "Summary".