Col Max
Col Max using Col Min
Summary: Visualizes data by coloring cells in a table based on specific conditions, utilizing the Match and Color Cells functions to highlight age, gender, height, and weight values.
Code:
dt = Open("data_table.jmp");
dt << set window size( 800, 500 );
minh = Col Min( Column( 4 ) );
rh = Col Max( Column( 4 ) ) - minh;
minw = Col Min( Column( 5 ) );
rw = Col Max( Column( 5 ) ) - minw;
For( i = 1, i <= N Row( dt ), i++,
Match( Column( 2 )[i],
12, Column( 2 ) << color cells( Red, {i} ),
13, Column( 2 ) << color cells( Green, {i} ),
14, Column( 2 ) << color cells( Blue, {i} ),
15, Column( 2 ) << color cells( Orange, {i} ),
16, Column( 2 ) << color cells( BlueGreen, {i} ),
17, Column( 2 ) << color cells( Purple, {i} )
);
Match( Column( 3 )[i], "F", Column( 3 ) << color cells( Red, {i} ), "M", Column( 3 ) << color cells( Blue, {i} ), );
valh = (Column( 4 )[i] - minh) / rh;
Column( 4 ) << color cells( Heat Color( valh, <<WhiteToBlue ), {i} );
valw = (Column( 5 )[i] - minw) / rw;
Column( 5 ) << color cells( Heat Color( valw, <<WhiteToBlue ), {i} );
);
Code Explanation:
- Open data table.
- Set window size.
- Find minimum height.
- Calculate height range.
- Find minimum weight.
- Calculate weight range.
- Loop through each row.
- Color age cells based on value.
- Color gender cells based on value.
- Color height cells based on normalized value.
- Color weight cells based on normalized value.
Col Max using Expr
Summary: Calculates maximum age from a data table, utilizing an Expr function to extract the relevant expression.
Code:
dt2 = Open("data_table.jmp");
max age expr = Expr( Col Max( :age ) );
Code Explanation:
- Open data table.
- Define max age expression.