<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Get count for grouping (panels) in graph builder to check the visualisation is sensible in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Get-count-for-grouping-panels-in-graph-builder-to-check-the/m-p/37101#M21782</link>
    <description>&lt;P&gt;Summarize is the way to go. &amp;nbsp;It can not do counts for character columns, but it can get the grouping values from which you can get the counts. &amp;nbsp;See the script below&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\big class.jmp" );
// Numeric Column
dt = Open( "$SAMPLE_DATA\big class.jmp" );
Summarize( dt, bygroup = by( :age ), counts = Count( :age ) );
Show( "Numeric Column", bygroup, counts );

// Character Column
Summarize( dt, bygroup = by( :sex ) );
counts = {};
For( i = 1, i &amp;lt;= N Items( bygroup ), i++,
	Insert Into( counts, N Rows( dt &amp;lt;&amp;lt; get rows where( :sex == bygroup[i] ) ) )
);
Show( "Character Column", bygroup, counts );&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 13 Mar 2017 17:20:29 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2017-03-13T17:20:29Z</dc:date>
    <item>
      <title>Get count for grouping (panels) in graph builder to check the visualisation is sensible</title>
      <link>https://community.jmp.com/t5/Discussions/Get-count-for-grouping-panels-in-graph-builder-to-check-the/m-p/37097#M21778</link>
      <description>&lt;P&gt;So I have written a bit of JSL which is able to take a data table and make suggestions of graphs. It checks the number of unique values, column data type and column name to assess which graph would be most appropriate.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One issue I am having is when it uses Page, Group X, Group Y and/or Wrap and there aren't many data points in the resulting panels. Below is a silly example using Big Class.&amp;nbsp;Clearly name is a poor grouping variable because each panel of the graph only contains one point.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="badpanels.jpg" style="width: 340px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/5560iEFF98917F386142C/image-dimensions/340x305?v=v2" width="340" height="305" role="button" title="badpanels.jpg" alt="badpanels.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Once my code has choosen a potential visualisation what would be the best way to check that the layout will not contain mostly panels which are data sparse/empty?&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Since I know how my variables are related I can build a table using tabulate, create a hidden data table, create a matrix and then check the sparsity of the matrix. This seems long winded.&lt;/LI&gt;&lt;LI&gt;I need count which I don't think is possible using the JSL summarise() function (in JMP 12) which doesn't create a table.&lt;/LI&gt;&lt;LI&gt;Is there an elegant way to build the count matrix?&lt;/LI&gt;&lt;LI&gt;Typically the code suggests three graphs for each item in the most numerous list (X, Y or Legend), so I want to avoid creating tables if possible.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Stephen&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Mar 2017 16:13:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-count-for-grouping-panels-in-graph-builder-to-check-the/m-p/37097#M21778</guid>
      <dc:creator>stephen_pearson</dc:creator>
      <dc:date>2017-03-13T16:13:43Z</dc:date>
    </item>
    <item>
      <title>Re: Get count for grouping (panels) in graph builder to check the visualisation is sensible</title>
      <link>https://community.jmp.com/t5/Discussions/Get-count-for-grouping-panels-in-graph-builder-to-check-the/m-p/37101#M21782</link>
      <description>&lt;P&gt;Summarize is the way to go. &amp;nbsp;It can not do counts for character columns, but it can get the grouping values from which you can get the counts. &amp;nbsp;See the script below&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\big class.jmp" );
// Numeric Column
dt = Open( "$SAMPLE_DATA\big class.jmp" );
Summarize( dt, bygroup = by( :age ), counts = Count( :age ) );
Show( "Numeric Column", bygroup, counts );

// Character Column
Summarize( dt, bygroup = by( :sex ) );
counts = {};
For( i = 1, i &amp;lt;= N Items( bygroup ), i++,
	Insert Into( counts, N Rows( dt &amp;lt;&amp;lt; get rows where( :sex == bygroup[i] ) ) )
);
Show( "Character Column", bygroup, counts );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Mar 2017 17:20:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-count-for-grouping-panels-in-graph-builder-to-check-the/m-p/37101#M21782</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2017-03-13T17:20:29Z</dc:date>
    </item>
    <item>
      <title>Re: Get count for grouping (panels) in graph builder to check the visualisation is sensible</title>
      <link>https://community.jmp.com/t5/Discussions/Get-count-for-grouping-panels-in-graph-builder-to-check-the/m-p/37128#M21800</link>
      <description>&lt;P&gt;Thanks for that example. If I have a Group Y and a Group X &amp;nbsp;(an potentially X as well) all as character then I need to nest three for loops? This rapidly becomes a way to tie up JMP in loops as the data tables are of an unknown size (Potentially a user could request 30 graphs all of which need the panel matrix calculating - I have capped the program to display only the first 30 suggestions).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Perhaps this is a better example using cars physical data, what I&amp;nbsp;was hoping for was a 3x5 matrix or a 15 item list.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="lessbadpanels.jpg" style="width: 395px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/5566iF71B04D8E5B6AF37/image-dimensions/395x300?v=v2" width="395" height="300" role="button" title="lessbadpanels.jpg" alt="lessbadpanels.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Am I best recoding the character columns as Numeric in order to make the best use of summarise()? Is likely to be quicker/tidier than for loops?&lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2017 08:55:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-count-for-grouping-panels-in-graph-builder-to-check-the/m-p/37128#M21800</guid>
      <dc:creator>stephen_pearson</dc:creator>
      <dc:date>2017-03-14T08:55:06Z</dc:date>
    </item>
    <item>
      <title>Re: Get count for grouping (panels) in graph builder to check the visualisation is sensible</title>
      <link>https://community.jmp.com/t5/Discussions/Get-count-for-grouping-panels-in-graph-builder-to-check-the/m-p/37132#M21804</link>
      <description>&lt;P&gt;If all of your grouping variables were numeric, it would be faster, because the summarize would be able to make quick work of the counting. &amp;nbsp;But that is very restrictive to the data and/or the user. &amp;nbsp;You could convert the summarize function calls to "Summary" platforms, and create tables which can handle both numeric and character columns. &amp;nbsp;You could do some timing tests to see if that will work.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\car physical data.jmp" );

dtsumm=dt &amp;lt;&amp;lt; Summary(private,
	Group( :type),
	N( :type ),
	Freq( "None" ),
	Weight( "None" )
);

show(dtsumm:type&amp;lt;&amp;lt;get values);
close(dtsumm,nosave);

dtsumm=dt &amp;lt;&amp;lt; Summary(private,
	Group( :country),
	N( :country),
	Freq( "None" ),
	Weight( "None" )
);

show(dtsumm:country&amp;lt;&amp;lt;get values);
close(dtsumm,nosave);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Mar 2017 11:34:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-count-for-grouping-panels-in-graph-builder-to-check-the/m-p/37132#M21804</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2017-03-14T11:34:06Z</dc:date>
    </item>
    <item>
      <title>Re: Get count for grouping (panels) in graph builder to check the visualisation is sensible</title>
      <link>https://community.jmp.com/t5/Discussions/Get-count-for-grouping-panels-in-graph-builder-to-check-the/m-p/37270#M21854</link>
      <description>&lt;P&gt;Turns out there is a JMP add-in which can &lt;A href="https://community.jmp.com/t5/JMP-Add-Ins/Compress-to-Labeled-Code/ta-p/23710" target="_blank"&gt;convert all the character columns to numeric&lt;/A&gt;. Thanks to&amp;nbsp;@M_Anderson&amp;nbsp;for &lt;A href="https://community.jmp.com/t5/Discussions/Assign-unique-ID-for-each-unique-text/m-p/37248" target="_self"&gt;pointing it out&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This makes it really easy to use summarise().&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2017 13:00:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-count-for-grouping-panels-in-graph-builder-to-check-the/m-p/37270#M21854</guid>
      <dc:creator>stephen_pearson</dc:creator>
      <dc:date>2017-03-16T13:00:01Z</dc:date>
    </item>
  </channel>
</rss>

