<?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: Need to help to use Split function in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Need-to-help-to-use-Split-function/m-p/218724#M43783</link>
    <description>&lt;P&gt;Here is a simple script that I would use to create the table you want.&lt;CODE class=" language-jsl"&gt;&lt;/CODE&gt;&lt;CODE class=" language-jsl"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Current Data Table();
colNames = dt &amp;lt;&amp;lt; get column names( string );
Summarize( dt, fruitGroups = by( :Fruit ) );

dt &amp;lt;&amp;lt; select where( :Fruit == fruitGroups[1] );
dtTrans = dt &amp;lt;&amp;lt; subset( selected rows( 1 ), selected columns( 0 ) );

For( i = 2, i &amp;lt;= N Items( fruitGroups ), i++,
	dt &amp;lt;&amp;lt; select where( :Fruit == fruitGroups[i] );
	dtTemp = dt &amp;lt;&amp;lt; subset( selected rows( 1 ), selected columns( 0 ) );
	For( k = 1, k &amp;lt;= N Cols( dtTemp ), k++,
		Column( dtTemp, k ) &amp;lt;&amp;lt; set name( colNames[k] || " " || Char( i ) )
	);
	// The line below was first published in error it has been corrected
	// dtTrans &amp;lt;&amp;lt; Update( With( Data Table( "Subset of Original table 2" ) ) );
	dtTrans &amp;lt;&amp;lt; Update( With( dtTemp ) );
	Close( dtTemp, nosave );
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 25 Jul 2019 10:59:42 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2019-07-25T10:59:42Z</dc:date>
    <item>
      <title>Need to help to use Split function</title>
      <link>https://community.jmp.com/t5/Discussions/Need-to-help-to-use-Split-function/m-p/218711#M43781</link>
      <description>&lt;P&gt;Can you somebody provide instructions to modify the attached original table to get to the final table. I assume I need to use Split function and then manually move the coloumns around, but the table I have on hand has multiple rows and coloumns so manually moving around is not an option. Any tricks that can be done here?&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 21:33:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Need-to-help-to-use-Split-function/m-p/218711#M43781</guid>
      <dc:creator>raj138</dc:creator>
      <dc:date>2019-07-24T21:33:11Z</dc:date>
    </item>
    <item>
      <title>Re: Need to help to use Split function</title>
      <link>https://community.jmp.com/t5/Discussions/Need-to-help-to-use-Split-function/m-p/218724#M43783</link>
      <description>&lt;P&gt;Here is a simple script that I would use to create the table you want.&lt;CODE class=" language-jsl"&gt;&lt;/CODE&gt;&lt;CODE class=" language-jsl"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Current Data Table();
colNames = dt &amp;lt;&amp;lt; get column names( string );
Summarize( dt, fruitGroups = by( :Fruit ) );

dt &amp;lt;&amp;lt; select where( :Fruit == fruitGroups[1] );
dtTrans = dt &amp;lt;&amp;lt; subset( selected rows( 1 ), selected columns( 0 ) );

For( i = 2, i &amp;lt;= N Items( fruitGroups ), i++,
	dt &amp;lt;&amp;lt; select where( :Fruit == fruitGroups[i] );
	dtTemp = dt &amp;lt;&amp;lt; subset( selected rows( 1 ), selected columns( 0 ) );
	For( k = 1, k &amp;lt;= N Cols( dtTemp ), k++,
		Column( dtTemp, k ) &amp;lt;&amp;lt; set name( colNames[k] || " " || Char( i ) )
	);
	// The line below was first published in error it has been corrected
	// dtTrans &amp;lt;&amp;lt; Update( With( Data Table( "Subset of Original table 2" ) ) );
	dtTrans &amp;lt;&amp;lt; Update( With( dtTemp ) );
	Close( dtTemp, nosave );
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 25 Jul 2019 10:59:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Need-to-help-to-use-Split-function/m-p/218724#M43783</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2019-07-25T10:59:42Z</dc:date>
    </item>
    <item>
      <title>Re: Need to help to use Split function</title>
      <link>https://community.jmp.com/t5/Discussions/Need-to-help-to-use-Split-function/m-p/218742#M43789</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thank you for the script. While it works amazingly for the table that I provided, I am having difficulty in making it work for my&amp;nbsp;actual data set. Attached is the data set and below is the modified code. Could you please take a look:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Current Data Table();
colNames = dt &amp;lt;&amp;lt; get column names( string );
Summarize( dt, slotGroups = by( :Slot ) );

dt &amp;lt;&amp;lt; select where( :Slot == slotGroups[1] );
dtTrans = dt &amp;lt;&amp;lt; subset( selected rows( 1 ), selected columns( 0 ) );

For( i = 2, i &amp;lt;= N Items( slotGroups ), i++,
	dt &amp;lt;&amp;lt; select where( :Slot == slotGroups[i] );
	dtTemp = dt &amp;lt;&amp;lt; subset( selected rows( 1 ), selected columns( 0 ) );
	For( k = 1, k &amp;lt;= N Cols( dtTemp ), k++,
		Column( dtTemp, k ) &amp;lt;&amp;lt; set name( colNames[k] || " " || Char( i ) )
	);
	dtTrans &amp;lt;&amp;lt; Update( With( Data Table( "Subset of Original table 2" ) ) );
	Close( dtTemp, nosave );
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jul 2019 05:36:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Need-to-help-to-use-Split-function/m-p/218742#M43789</guid>
      <dc:creator>raj138</dc:creator>
      <dc:date>2019-07-25T05:36:12Z</dc:date>
    </item>
    <item>
      <title>Re: Need to help to use Split function</title>
      <link>https://community.jmp.com/t5/Discussions/Need-to-help-to-use-Split-function/m-p/218765#M43792</link>
      <description>&lt;P&gt;Oops....my error, here is a corrected script&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Current Data Table();
colNames = dt &amp;lt;&amp;lt; get column names( string );
Summarize( dt, slotGroups = by( :Slot ) );

dt &amp;lt;&amp;lt; select where( :Slot == slotGroups[1] );
dtTrans = dt &amp;lt;&amp;lt; subset( selected rows( 1 ), selected columns( 0 ) );

For( i = 2, i &amp;lt;= N Items( slotGroups ), i++,
	dt &amp;lt;&amp;lt; select where( :Slot == slotGroups[i] );
	dtTemp = dt &amp;lt;&amp;lt; subset( selected rows( 1 ), selected columns( 0 ) );
	For( k = 1, k &amp;lt;= N Cols( dtTemp ), k++,
		Column( dtTemp, k ) &amp;lt;&amp;lt; set name( colNames[k] || " " || Char( i ) )
	);
	dtTrans &amp;lt;&amp;lt; Update( With( dtTemp ) );
	Close( dtTemp, nosave );
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 25 Jul 2019 10:51:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Need-to-help-to-use-Split-function/m-p/218765#M43792</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2019-07-25T10:51:52Z</dc:date>
    </item>
    <item>
      <title>Re: Need to help to use Split function</title>
      <link>https://community.jmp.com/t5/Discussions/Need-to-help-to-use-Split-function/m-p/218815#M43798</link>
      <description>&lt;P&gt;Works like a charm, thank you very much.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jul 2019 21:30:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Need-to-help-to-use-Split-function/m-p/218815#M43798</guid>
      <dc:creator>raj138</dc:creator>
      <dc:date>2019-07-25T21:30:57Z</dc:date>
    </item>
  </channel>
</rss>

