:Class TamStatEx : MiPage
CREATED←{2016 7 17 15 56 41 303}
:Include #.AplExamples ⍝ programs and fns from Jerry Brennan AplExamples.PDF
⍝ Try TestLog
:Include #.TryAPLSlave ⍝ protected input by Brian Becker
:Include #.HTMLInput
:Include #.Strings
:Include #.TamStat ⍝ fns by Stephen M. Mansour
:Include #.TamStatDistribution ⍝ fns by Stephen M. Mansour ribution
:Include #.TamStatRelational ⍝ fns by Stephen M. Mansour ional
:Include #.TamStatOperators ⍝ fns by Stephen M. Mansour new
:Include #.TamStatSummary ⍝ fns by Stephen M. Mansour
:Include #.TamStatUtil ⍝ fns by Stephen M. Mansour
:Include #.TamStatGraph ⍝ fns by Stephen M. Mansour
:Include #.TamStatArithmetic ⍝ fns by Stephen M. Mansour
:Include #.TamStatRegression ⍝ fns by Stephen M. Mansour
:Field Public R_Available←0 ⍝ don't try to use R . It's not available
:Field Public Input←'3+4 6 10' ⍝ Name of edit field for input
:Field Public Res←,'' ⍝ Name of edit field for output
:Field Public ResRows←'25' ⍝ Name of edit field for rows of output
:Field Public CurrentTab←0 ⍝ Zero-based position of the currently selected tab
:Field Public Action←'' ⍝ All action buttons have this name
:Field Public GraphHtml←'' ⍝ link to possible Plot file if a plot was requested.
:Field Public filedata←'' ⍝ data read from users computer 1:filename 2:data
:Field Public fILE←'' ⍝ file name
:Field Public dATA←'' ⍝ file data all first row var names and the data
:Field Public vARS←'' ⍝ vars names
:Field Public rOWS←'' ⍝ number of rows
:Field Public cOLS←'' ⍝ number of cols
:Field Public D←⎕NS '' ⍝ Namespace holds each vars read in from computer file
∇ Render req;content;headers;html;base;H2;opts;t
:Access Public
GraphHtml←⊂'' ⍝ init graph to nothing
⍝ JB setup for click copy to Input e.g. (Ex2In '5?5') --> <b class="exec" title="click to copy to Input: below and press Calc button">5?5</b>
Ex2In←{'<b class="exec" title="Click to copy to Input: below and press Calc button">',⍵,'</b>'}
⍝ WB - Establish needed CSS style sheet and Javascript for Primer keypad
req.Use'JQueryUI'
req.Style'/Styles/aplkb.css'
'src="/Scripts/keychangecr.js" charset="UTF-8"'req.Script''
'src="/Scripts/langbar.js" charset="UTF-8"'req.Script''
'src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"'req.Script''
⍝ WB - Define primer html code from file
primer←⎕SE.UnicodeFile.ReadText #.Boot.AppRoot,'HTML/guide.html'
⍝ WB - Define Primer "Toggle" button
⍝ WB toggle←'button id="primerToggle" title="dog"'Enclose'Primer'
primtit←'Click this Primer button to show/hide the APL Primer a floating keypad of APL symbols. '
primtit,←'Hover mouse over any APL character to see a pop-up explaining more about the symbol with examples and shortcut to enter it directly from your keyboard. '
primtit,←'Click on any APL symbol on keypad and that character will be entered into the INPUT field below. '
primtit,←'Then Click CALC or press your ENTER KEY to process your calcuation and see the results.'
toggle←('button id="primerToggle" title="',primtit,'"')Enclose'Primer'
DoAction ⍝ If a button pressed call DoAction fns below
⎕PATH←'# #.AplExamples #.TamStat #.TamStatDist #.TamStatRelat #.TamStatSummary #.TamStatUtil #.TamStatGraph #.TamStatArithmetic #.TamStatRegression'
⍝ set up the tabs & content
headers←'Intro' 'Input' 'Central Tendency' 'Dispersion' 'Confid Interval' 'Sample Size' 'Confid & t-test' 'Paired t-test' 'Regression' 'Plot' 'Work' 'Ref Card' 'Primer Help'
content←(⍴headers)⍴⊂''
sp←⊂' '
html←'<code><b>Taming Statistics: Learn & Do with Examples: by Stephen M Mansour & Jerry M Brennan.</b>'
html,←BR,'Download any PDF listed below & then try examples below.<br>(A split screen with 2 windows might be helpful. Put PDF window on 1 side & this window on other side.)<br>(Then you can drag examples from PDF into <b>Input:</b> box below, and click <b>Calc</b> button.)'
html,←'<li><a href="TamS/AplExamples.pdf">APL Lessons and Examples: PDF by Jerry M Brennan 67 pages (revised 4/19/2017)</a></li>'
html,←'<li><a href="Tams/TamingStatistics.pdf">Statistical Calculations by Stephen M. Mansour(pdf) (revised 1/1/2015)</a></li>'
html,←'<li><a href="Tams/TamStatRefCard.pdf">Reference Card by Stephen M. Mansour(pdf) (revised 9/13/2016)</a></li>'
html,←'<li><a href="Tams/TamingInferentialStatistics-1JB.pdf">Inferential Statistics by Stephen M. Mansour(pdf) (revised Jan 20, 2015)</a></li>'
html,←'<li><a href="Tams/TamStatUserGuide.pdf">Taming Statistics Users Guide by Stephen M. Mansour(pdf) (revised 7/19/2016)</a></li>'
html,←'<li><a href="Tams/SampleData.csv">Click Here for: Users Guide SampleData.csv & choose where to save it on YOUR computer).</a></li>'
html,←'Now Import <b>SampleData.csv</b> variables into APL. Press <b>Choose File</b> below & then Press <b>Import to Namespace D</b>'
html,←BR,'Now type/drag <b>D.Student</b> or <b>D.Sex</b> or.. to <b>Input:</b> box & Press <b>Calc</b> to see data.'
content[t←1]←⊂html,'<br>'
html←'<b>You can input data in 3 different ways.</b>'
html,←BR,'<b>1. Data dragged or copied & pasted</b>(i.e. from PDF examples) into the <b>Input:</b> box below.'
html,←BR,'1b. Example: Drag or copy & paste <b>+/1 3 4</b> to <b>Input:</b> box below & Press <b>Calc</b>'
html,←BR,'1c. Example: Click any <b>purple</b> text ',(Ex2In '+/2 4 6 7'),' to copy it to <b>Input:</b> box below & Press <b>Calc</b>'
html,←BR,'<b>2. Data from file:</b> use <b>Choose File</b> button below. File can use either commas or spaces between values.'
html,←BR,'2a. First row must contain variable names and following rows each contain 1 value for each of the named variables.'
html,←BR,'2b. Variable names must begin with letter & contain only upper & lower case letters and/or digits 0-9. Spaces in names not allowed.'
html,←BR,'2c. Data can be numeric or any characters(except commas). Character Spaces ok if comma separators.'
html,←BR,'2d. Example: row 1 names: <b>Name,Age</b> rows 2&3 data:<b>Jim Ito,12</b> and <b>Jo Til,22</b>'
html,←BR,'2e. Data is stored in namespace: <b>D</b> so use full name to access it: <b>D.Name</b> or <b>D.Age</b>'
html,←BR,'<b>3. Data entered by you</b> into <b>Input:</b> box below.'
html,←BR,'3a. Begin with valid variable name(letter first & contain only upper & lower case and/or digits 0-9).'
html,←BR,'3b. Variable name then assignment <code><b>←</b></code> then data with spaces between #''s or chars with single quotes around each char data.'
html,←BR,'3c. To get the assignment arrow <code><b> ← </b></code> to <b>Input:</b> box drag it or click <b>Primer</b> button then the arrow symbol <b>←</b>.'
html,←BR,'3d. Examples: Numeric: ',(Ex2In 'AGE←15 13 11'),' Character: ',(Ex2In 'SexOfChild←''Male'' ''Unknown'' ''Female''')
html,←BR,'3e. Click on each of above in <b>purple</b> to copy to <b>Input:</b> box & press <b>Calc</b> on each.'
html,←BR,'3f. Now Click each of these: ',(Ex2In 'AGE'),' and ',(Ex2In 'SexOfChild'),' to send to <b>Input:</b> box & press <b>Calc</b> on each.'
html,←BR,'3g. Now Click each of these: ',(Ex2In '↑AGE SexOfChild'),' and ',(Ex2In '⍉↑AGE SexOfChild'),' to send to <b>Input:</b> box & press <b>Calc</b> on each.'
content[t←t+1]←⊂html
html←'<b>Central Tendency:(for ordered numeric data only)</b>'
html,←BR,'Four common measures of central tendency are: <b>mean median mode proportion</b>'
html,←BR,BR,'Let''s create some random data and evaluate it.'
html,←BR,'Click ',(Ex2In 'DATA←?25⍴9'),' & press <b>Calc</b> button below Input:'
html,←BR,'Now click ',(Ex2In 'DATA'),' & press <b>Calc</b> to see 25 random #''s from 1-9.'
html,←BR,'Now click each then press Calc for each of the following: 1) ',(Ex2In 'mean DATA'),' 2) ',(Ex2In 'median DATA'),' 3)',(Ex2In 'mode DATA')
html,←BR,'Now create proportion data click: ',(Ex2In 'PRO←¯1+?35⍴2'),' & view it ',(Ex2In 'PRO'),' & find it''s central tendency ',(Ex2In 'proportion PRO')
content[t←t+1]←⊂html
html←'<b>Common measures of Dispersion:</b>'
html,←BR,'<b>range min max variance standardDeviation quartile skewness kurtosis frequency</b>'
html,←BR,'All work on ordered numeric data. <b>frequency</b> also works on character & categorical numeric data.</b>'
html,←BR,'Try each on your data or from SampleData.csv(if variables listed below or <b>Choose File</b> to reimport them).'
html,←BR,'For imported data from SampleData.csv remember to include Namespace D. Click: ',(Ex2In 'frequency D.Eyes')
html,←BR,'For a labeled barchart click follwing to Input window and click Calc: ',(Ex2In 'FreqBar ⍉frequency D.Eyes')
content[t←t+1]←⊂html
html←'<b>Confidence Interval:</b>'
html,←BR,'If you took a # of samples from data pool & calculated means for each they would all be somewhat different. Each sample mean would be an estimate of the population mean. Most would be close to the population mean but some might differ quite a bit. If you took larger samples the sample means would tend to be closer to the population mean with fewer outlier means. Most would be either a little less or a little more with fewer extremely more or extremely less. Statistically this would tend towards a bell shaped curve. Statistics can thus be applied to compute a confidence interval. We can''t be sure our sample is a perfect estimate, but we can determine a confidence interval around our sample mean using sample size & variability. A 95% confidence interval is often used(i.e. we''re 95% certain the population mean is in the confidence interval around our sample mean.'
html,←BR,'<b>Example 1</b>: You sample 100 students & 55 say they will vote for Mary. Can you be 95% certain she''ll win(get >50% of votes)? Click purple code below to send code to <b>Input:</b> box & click <b>Calc</b> to see. Code below first creates the data & then determines confidence interval:'
html,←BR,(Ex2In '.95 proportion confidenceInterval YES←55 45/1 0')
html,←BR,'Now click it again but modify YES to 60 & no to 40 before pressing the <b>Calc</b> to see that the confidence interval.'
html,←BR,'The confidence interval for 55/45 encompassed values below .50 so we could not be 95% sure, but 60/40 did not. Now play with bigger samples(try 200 ie 120 80 for the 60 40 %) or different confidence intervals such as .99 by making slight modifications of your <b>Input:</b> box below.'
content[t←t+1]←⊂html
html←'<b>Determine Sample Size Needed To Demonstrate Significant Results:</b>'
html,←BR,'<b>If your samples are too small you will not demonstrate significant differences. If samples are too big you will be wasting time/money/your energy. Picking the right sample size if a very very important first step in doing research. </b>'
html,←BR,'To determine the sample size you must know the size of the difference you wish to detect and have an estimate of the variability you will encounter in your data. If you wanted to detect a 2 point difference of the mean in your sample data 95% of the time and the standard deviation in your data was 12.'
html,←BR,'Click purple code to send the following to Input line below: ',(Ex2In '.95 mean sampleSize 2 12'),' and press the <b>Calc</b> button to find the sample size needed.'
html,←BR,'To be 99% sure that Mary will get >50% of the vote if in your sample of students 55% or more said they would vote for Mary, how big of sample do you need?'
html,←BR,'Click and press calc on this to find the sample size needed: ',(Ex2In '.99 proportion sampleSize .05 .55')
content[t←t+1]←⊂html
html←'<b>Hypothesis Testing: Confidence Intervals & t-test</b>'
html,←BR,'If average height of people is 68", is that significantly different than <b>SampleData.csv</b> data?'
html,←BR,'Significantly commonly means we want to be 95% certain difference we got is not due to chance.'
html,←BR,'Since data is a sample of people other samples could be taken & they would have different means.'
html,←BR,'Let''s calculate sample mean & using sample variability the 95% confidence interval of the mean.'
html,←BR,'Click following purple code to <b>Input:</b> box and press <b>Calc</b>'
html,←BR,(Ex2In 'mean D.Height'),' and ',(Ex2In '.95 mean confidenceInterval D.Height')
html,←BR,'Since the 95% confidence interval does not include 68 we are 95% sure that sample is different.'
html,←BR,'We can also do .05 significance test: <b>.05 report D.Height mean hypothesis = 68</b>'
html,←BR,'Now to see if male heights differ significantly from females: Click and Calc each<b> of next 3 lines'
html,←BR,(Ex2In 'mean MaleHeight←(D.Sex eq''M'')/D.Height')
html,←BR,(Ex2In 'mean FemaleHeight←(D.Sex eq ''F'')/D.Height')
html,←BR,(Ex2In '.95 mean confidenceInterval¨ FemaleHeight MaleHeight')
html,←BR,'No overlap in confidence intervals so 95% sure male & female means are not equal(ne).'
html,←BR,'Now we can verify with this: ',(Ex2In '.05 report MaleHeight mean hypothesis ne FemaleHeight')
content[t←t+1]←⊂html
html←'<b>Hypot Test:paired t-test</b>'
html,←BR,'On previous tab we compared 2 different groups: males and females. In this example we compare same people before and after a treatment. In this case imagine the same students being tested before and after watching a calculus video. Click on each purple text below to copy to Input: then press <b>Calc</> to see each result.'
html,←BR,(Ex2In 'mean PRE←18 21 16 22 19 24 17 21 23 18 14 16 16 19 18 20 12 22 15 17')
html,←BR,(Ex2In 'mean POS←22 25 17 24 16 29 20 23 19 20 15 15 18 26 18 24 18 25 19 16')
html,←BR,(Ex2In 'DIFS,mean DIFS←POS-PRE'),' ⍝ show diffs & mean dif between pre & post scores for each student.'
html,←BR,(Ex2In '.05 report DIFS mean hypothesis>0'),' ⍝ Average difference is significantly > 0 (1tailed t-test ⍺=.05)'
html,←BR,(Ex2In '.95 mean confidenceInterval DIFS'),' ⍝ 95% confidence interval of average diff(2.05) is above 0.'
content[t←t+1]←⊂html
html←'<b>Regression:</b>'
html,←BR,'click: ',(Ex2In 'report regress D.ShoeSize D.Height D.Student')
html,←BR,'Results:B0 intercept significant p=.00002 (but not really important avg ShoeSize is < Height)'
html,←BR,'Results:B1 significant p=.00000 (Height is useful in predicting ShoeSize)'
html,←BR,'Results:B2 not significant p=.71269 (Student # is not useful in predicting ShoeSize)'
html,←BR,'click: ',(Ex2In 'D.ShoeSize RegLinPlot D.Height')
content[t←t+1]←⊂html
html←'<b>Plot:</b>There are 100''s of plotting routines. Here are a few you may find useful.'
html,←BR,'<b>plotxy</b> for example plots first variable on x and all rest(1 or more) on y axis:'
html,←BR,'click: ',(Ex2In 'X←1 2 3 4 ⋄ Y1←4 6 7 8 ⋄ Y2←3 5 9 11 ⋄ plotxy X Y1 Y2')
html,←BR,'click: ',(Ex2In 'ch.Set(''Head'' ''My Plot'')(''Ycap'' ''Y label'')(''Xcap'' ''Xlabel'')(''Key'' ''Y1,Y2'') ⋄ plotxy X Y1 Y2</b>')
html,←BR,'click: ',(Ex2In 'stemleaf 500+?50⍴120')
html,←BR,'click: ',(Ex2In 'boxandwisker 5+?50⍴12')
html,←BR,'click: ',(Ex2In 'FreqBar Freq ?500⍴12'),' or just click: ',(Ex2In 'freq ?500⍴12'),' to see just frequency table.'
html,←BR,'click: ',(Ex2In 'QuadPlot 2 ¯1 ¯7'),' ⍝ for Equation: (2x*2)+(¯1x)+(¯7) and thus:a=2 b=¯1 c=¯7'
html,←BR,'click: ',(Ex2In '5 25 .000001 PlotAreaUnderCurve ''(X*2)+5'''),' ⍝ for Y=5+X*2 from X=5 to 25 with 6 decimal accuracy'
content[t←t+1]←⊂html
html←'Work'
content[t←t+1]←⊂html
html←'' ⍝ Ref Card
base←'<p><img src="/jbgames/TamS/PNGFILE.png" width="700" height="500"/></p>' ⍝ where some txt/pics are stored
content[t←t+1]←⊂html,(base subst'PNGFILE' 'TamStatRefCard_1'),(base subst'PNGFILE' 'TamStatRefCard_2')
⍝ Setup TAB Content for Primer
html←'Click on Primer button to show/hide the APL Primer a floating keypad of APL symbols.'
html,←BR,BR,'Drag the floating keypad to a convenient place on the screen.'
html,←BR,BR,'Hover mouse over any APL character to see a pop-up explaining more about the symbol with examples and shortcut to enter it directly from your keyboard.'
html,←BR,BR,'If you "click" on any APL symbol on Keypad that character will be added to the INPUT field below.'
html,←BR,BR,'When your INPUT field is completed Click <b>CALC</b> button or press your "ENTER KEY" to process your calcuation and see the results.'
content[t←t+1]←⊂html
⍝ --------------------------------------------------------------------------------------------------
⍝ Setup bottom APL calculation section Content
H2←'Taming Statistics Move Cursor to tabs to Learn and Do Statistics.'
html←'h2'Enclose H2
⍝ WB - Write html with (hidden) primer html table code and "Primer" toggle button
html,←(⊃,/90⍴sp),'<code><b>Click Primer button to easily learn & generate APL symbols. </b>',toggle,'</code>',primer
⍝ Set JQuery current Tab
opts←'activate: function(event,ui){$("#CurrentTab").val($(this).tabs("option","active"));}, active: ',(⍕CurrentTab)
html,←req #.JQUI.Tabs'mytabs'headers content opts
⍝ Start FORM TAG
html,←'<form action="',req.Page,'" method="post" enctype="multipart/form-data">'
html,←BR'To input datafile (row1=var names, rows2-n=data)<b> Choose File</b> then <b>Import</b>'
:If 1≠≡filedata ⍝ :If req.IsPost ⍝ just display some information about the file...
html,←BR,'You selected file: ',(1⊃filedata),' and its size is: ',⍕⍴2⊃filedata
:EndIf
html,←'filedata'File''
html,←'Action'Submit'Import to Namespace D' ⍝ 2 BRA BR
:If (~0∊⍴filedata)∧(~0∊⊃¨⍴¨filedata)
fILE dATA←filedata ⋄ aV←⎕AV⍳dATA
vARS←(¯1+aV⍳4)↑dATA ⋄ cOLS←⍕1++/vARS=',' ⋄ rOWS←⍕¯1++/4=aV
D←import2D dATA ⍝ create variables in namespace D
filedata←''
:EndIf
:If D≡'IMPERR'
html,←'ERROR Importing Variables from File=',fILE,' (1st line must be valid(begin letter,contain only letters & numbers) variable names, next lines must each have 1 piece data for each variable)'
html,←'Action'Submit'Clear Data'
D←''
:ElseIf ~0∊⍴fILE
html,←'Input File=',fILE,' Rows=',rOWS,' Columns=',cOLS,' Namespace=D Variables=',vARS
html,←'Action'Submit'Clear Data'
:EndIf
⍝ set up live equation solver which can actually do most APL here.
⍝ html,←BR,'<code>APL symbols: ← +-×÷*⍟⌹○!? |⌈⌊⊥⊤⊣⊢ =≠≤<>≥≡≢ ∨∧⍲⍱ ↑↓⊂⊃⌷⍋⍒ ⍳⍷∪∩∊~ /\⌿⍀ ,⍪⍴⌽⊖⍉ ¨⍨⍣.∘ ⍞⎕⍠⍎⍕ ⋄⍝→⍵⍺∇&¯⍬'
⍝ html,←BR,'Enter #''s & drag APL symbols to solve: e.g. enter/drag: birthdaysame ¨50 66'
⍝ html,←BR,'to determine the odds of 2 people having same birthday for each(¨) 50 & 66 people at the party.'
⍝ html,←BR,'Notes: drag ¯ do not type - for neg #''s. To see program code use ⎕cr or ⎕vr e.g.: ⎕cr ''birthdaysame'''
⍝⍝ Start FORM TAG (moved above)
⍝⍝ html,←'<form action="',req.Page,'" method="post" enctype="multipart/form-data">'
⍝⍝ WB ⍝⍝ html,←BR,'Input :','Input'Edit Input 93('title="enter APL code and press: Calc" ID=APLedit') ⍝ An "Edit" called "Input" containing the APL
⍝⍝ WB - Had to write this line of HTML to set the Input id="APLedit" needed by the APL keyboard JavaScript program
html,←BR,'Input :<input title="enter APL code and press: Calc" size="93" type="text" value="" id="APLedit" name="Input" />'
html,←BR,'Result:',('Action'Submit'Calc'),('Action'Submit'Clear Input'),('Action'Submit'Clear Output'),('Action'Submit'TryAPL') ⍝ Action buttons
html,←' Set Rows Visible for Scrollable Results Window=',('ResRows'DropDown(⍕¨5×1 2 5 10 15 30 60 120)(,ResRows))
html,←BR,'Res'MultiEdit((6⌈(⍎ResRows)⌊500),100)Res('readonly="readonly" style="width:99%" ') ⍝ title="Result field. You cannot type into this field."
html,←'CurrentTab'Hidden⍕CurrentTab
⍝⍝ WB ⍝⍝ html←req('post'Form)html ⍝ Put a 'submit' form around it. WB felt it not needed.
html←html,BR,GraphHtml ⍝ add the Graph if there is one
⍝ End FORM TAG
html,←'</form></code>'
req.Return html
∇
∇ DoAction;Ans;errmsg;rAiN
⍝ Res is all results Ans is result from last calculation only
:Select Action
:Case 'Clear Data' ⋄ D filedata fILE dATA rOWS cOLS vARS←⊂''
:Case 'Clear Input' ⋄ Input←''
:Case 'Clear Output' ⋄ Res←⊂'' ⋄ ⍝ ResRows←'5'
:Case 'Calc' ⍝ do the calculation
:If ∨/'ch.'⍷Input ⋄ rAiN←RainProIn ⋄ :End ⍝ if setting up plot chk RainPro loaded
:Trap 0 ⍝ If error in next line go to 2nd :Else statement and show error
:Trap 2 ⋄ Ans←⍕⍎Input ⋄ :Else ⋄ Ans←'no result' ⋄ :End ⍝ if result convert to char
:If 0≡⍴Ans ⋄ Res←Input,' [Recheck your math please.]'
:Else ⋄ Res←(2↓⊃,/(⊂CRLF),¨(↓' ',Input),(↓Ans)),CRLF,Res ⍝ display Input and result
:End
:Else ⋄ Res←(2↓⊃,/(⊂CRLF),¨⎕DM),CRLF,Res ⍝ :trap 0 tripped so show system diagnostic message generated
:EndTrap
:Case 'TryAPL'
Ans←Do Input
:If 0≡1⊃Ans ⋄ Ans←⊃1↓Ans
:Else ⋄ Ans←⍕Ans
:EndIf
Res←(2↓⊃,/(⊂CRLF),¨(↓' ',Input),(↓Ans)),CRLF,Res
:EndSelect
∇
import2D←{⎕ML ⎕IO←3 0
⍝⍵ Path/Filename of CSV file
⍝← Namespace containing values
⍝ FN←⍵,(~∨/s⍷⍵)/s←'.csv'
⍝ TN←FN ⎕NTIE ¯1
⍝ D←⎕NREAD TN 82(⎕NSIZE ¯1)0
0::'IMPERR' ⍝ return IMPERR if any error occurs
D←⍵
D←(~D∊⎕TC)⊂D
Parse←{w←(',,'⎕R',⍬,')⍣≡⍵
z←(⍺≠w)⊂w
k←⎕VFI¨z
b←{(↑⍵)≡,1}¨k
(b/z)←1 0∘⊃¨b/k
z}
sep←{','∊⍵:',' ⋄ ' '}↑D ⍝ if , use else use blanks JB
H←sep Parse↑D ⍝ Header (Variable Names ⍝ added sep JB
D←⊂[0]⊃sep Parse¨1↓D ⍝ added sep JB
D←H{1=⍴⍺:⊃⍵ ⋄ ⍵}D ⍝ ⊃ if only 1 variable JB
⍝ c←1<≡¨D ⍝ Character data? ⍝ commented as not used JB
⍝ (c/D)←{↑{⍺,',',⍵}/⍵}¨c/D
_←⍎⍕H'←D'
NS←⎕NS H
⍝ _←⎕NUNTIE TN
NS
}
∇ z←RainProIn ⍝ workaround for no result command below not accepted in dfn
:If z←0=⎕NC'ch'
(↑'ch' 'PostScrp' 'svg')⎕CY'rainpro' ⍝ Bring in rainpro if not avail
⎕DL 0.5
:EndIf
∇
:EndClass