// always start with this Names Default To Here(1); if (NameSpaceExists("recall.example-jsl.david.burnham"), nsRecall = NameSpace("recall.example-jsl.david.burnham") , nsRecall = NewNameSpace("recall.example-jsl.david.burnham"); nsRecall:lstX = {}; nsRecall:lstY = {}; ); app = NewNamespace("app.example-jsl.david.burnham"); // user-defined functions MyGraph = Function({yCol,xCol,lstX},{default local}, vlb = VListBox( gb = Graph Builder( Size( 415, 277 ), Show Control Panel( 0 ), Show Legend( 0 ), Variables( X( Eval(xCol) ), Y( Eval(yCol) ) ), Elements( Points( X, Y, Legend( 2 ) ), Smoother( X, Y, Legend( 3 ) ) ) ) ); cs = gb << Column Switcher( xCol, lstX ); cs << Make Column Switch Handler( preCSHandler, postCSHandler ); return(vlb); ); MyHistograms = Function({yCol,xCol,xType},{default local}, if (xType=="Continuous", Distribution( Continuous Distribution( Column( Eval(yCol) ), Summary Statistics( 1 ) ), Continuous Distribution( Column( Eval(xCol) ), Summary Statistics( 1 ) ), Histograms Only ) , // else Distribution( Continuous Distribution( Column( Eval(yCol) ), Summary Statistics( 1 ) ), Nominal Distribution( Column( Eval(xCol) ), Frequencies( 1 ) ), Histograms Only ) ); ); MyRegression = Function({yCol,xCol},{default local}, Bivariate( Y( Eval(yCol) ), X( Eval(xCol) ), Fit Line( {Confid Shaded Fit( 1 ), Line Color( {212, 73, 88} )} ), SendToReport( Dispatch( {}, "Bivar Plot", FrameBox, {Frame Size( 310, 177 )} ), Dispatch( {"Linear Fit"}, "Analysis of Variance", OutlineBox, {Close( 1 )} ) ) ); ); MyOneway = Function({yCol,xCol},{default local}, Oneway( Y( Eval(yCol) ), X( Eval(xCol) ), Means( 1 ), Mean Diamonds( 1 ), SendToReport( Dispatch( {}, "Oneway Plot", FrameBox, {Frame Size( 334, 184 )} ), Dispatch( {"Oneway Anova"}, "Summary of Fit", OutlineBox, {Close( 1 )} ), Dispatch( {"Oneway Anova"}, "Pooled t Test", OutlineBox, {Close( 1 )} ) ) ) ); preCSHandler = Empty(); postCSHandler = Function({oldCol, newCol, this},{default local}, app = Namespace("app.example-jsl.david.burnham"); app:xColName = newCol << getName; app:xType = newCol << getModelingType; if (app:xtype=="Continuous", app:btn2 << setButtonName("fit regression line"); app:btn2 << setScript( app = Namespace("app.example-jsl.david.burnham"); MyRegression(app:yColName,app:xColName) ); , app:btn2 << setButtonName("perform oneway ANOVA"); app:btn2 << setScript( app = Namespace("app.example-jsl.david.burnham"); MyOneway(app:yColName,app:xColName) ); ); ); // main code follows dt = CurrentDataTable(); if (IsEmpty(dt), NewWindow("Missing Data", <