This week’s Friday Function is a utility that allows me to display the contents of a table in a window.
Here is the code used to create the above output:
1 2 3 4 5 6 7 8 9 10 11 12 |
dt = Open("$SAMPLE_DATA/Big Class.jmp"); content = H List Box( Bivariate( Y( :weight ), X( :height ), Fit Line, ), Outline Box("Data", <<Outline Close Orientation("Vertical"), Data Table To Table Box(dt) ) ); New Window("My Analysis",content); |
And here is the definition of the function Data Table To Table Box:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
Data Table To Table Box = Function({dt},{Default Local}, tb = Table Box(); For (i=1,i<=NCols(dt),i++, col = Column(dt,i); colName = col << Get Name; lstValues = col << Get Values; type = col << Get Data Type; If (type=="Character", tb << Append( String Col Box(colName,lstValues) ) , tb << Append( Number Col Box(colName,lstValues) ) ); ); Return(tb); ); |
Share the joy: