<?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: Quickest way to iterate over a data table in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Quickest-way-to-iterate-over-a-data-table/m-p/903280#M106227</link>
    <description>&lt;P&gt;Many times, moving away from conventional row by row JSL in favor of using matrix operations will result in faster processing.&amp;nbsp; However, it would be helpful if you could provide an example of the actual formulas you are using.&lt;/P&gt;</description>
    <pubDate>Wed, 24 Sep 2025 09:13:10 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2025-09-24T09:13:10Z</dc:date>
    <item>
      <title>Quickest way to iterate over a data table</title>
      <link>https://community.jmp.com/t5/Discussions/Quickest-way-to-iterate-over-a-data-table/m-p/903216#M106219</link>
      <description>Hello, &lt;BR /&gt;&lt;BR /&gt;We have a JMP table with millions of rows (image data), and each operation is costly and time-consuming. However, we need to add a new column that will be calculated from the other columns.&lt;BR /&gt;&lt;BR /&gt;What is the fastest way to do this with large data sets? Currently, we are using Set Formula on the column, but it takes a long time to apply and, what's more, the formula is bound to be changed several times during the analysis. Should we use ‘get values’ vectors or something like that? I have also seen the ‘for each rows’ function. I would appreciate any feedback and tips you may have.</description>
      <pubDate>Wed, 24 Sep 2025 05:16:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Quickest-way-to-iterate-over-a-data-table/m-p/903216#M106219</guid>
      <dc:creator>SophieCuvillier</dc:creator>
      <dc:date>2025-09-24T05:16:21Z</dc:date>
    </item>
    <item>
      <title>Re: Quickest way to iterate over a data table</title>
      <link>https://community.jmp.com/t5/Discussions/Quickest-way-to-iterate-over-a-data-table/m-p/903280#M106227</link>
      <description>&lt;P&gt;Many times, moving away from conventional row by row JSL in favor of using matrix operations will result in faster processing.&amp;nbsp; However, it would be helpful if you could provide an example of the actual formulas you are using.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Sep 2025 09:13:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Quickest-way-to-iterate-over-a-data-table/m-p/903280#M106227</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2025-09-24T09:13:10Z</dc:date>
    </item>
    <item>
      <title>Re: Quickest way to iterate over a data table</title>
      <link>https://community.jmp.com/t5/Discussions/Quickest-way-to-iterate-over-a-data-table/m-p/903648#M106262</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your response.&lt;/P&gt;
&lt;P&gt;To add more context:&amp;nbsp;Below is a script with an example of the formula I use. Based on the X/Y coordinates on the image, I divide it into zones, 20 in total on my real date. If the classification of the zones is not correct, I will modify the formula, which is why I say that we will frequently use set formulas.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = New Table( "Reprex",
    Add Rows( 1000000 ),
    New Column( "X", Numeric, Continuous, Formula( Random Integer( 0, 200 ) ) ),
    New Column( "Y", Numeric, Continuous, Formula( Random Integer( 0, 200 ) ) )
);

R_debut_X = 10;
largeur   = 50;
ecart_X   = 5;
debut_Y   = 20;
hauteur   = 30;
ecart_Y   = 5;

// Slow way: row formula
dt &amp;lt;&amp;lt; New Column( "Zone_slow", Character,
    Formula(
        If( R_debut_X &amp;lt; :X &amp;lt;= R_debut_X + largeur &amp;amp; debut_Y &amp;lt; :Y &amp;lt;= debut_Y + hauteur, "Zone 1",
            R_debut_X + largeur + ecart_X &amp;lt; :X &amp;lt;= R_debut_X + 2*largeur + ecart_X &amp;amp; debut_Y &amp;lt; :Y &amp;lt;= debut_Y + hauteur, "Zone 2",
            "Other"
        )
    )
);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Sep 2025 11:28:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Quickest-way-to-iterate-over-a-data-table/m-p/903648#M106262</guid>
      <dc:creator>SophieCuvillier</dc:creator>
      <dc:date>2025-09-25T11:28:23Z</dc:date>
    </item>
    <item>
      <title>Re: Quickest way to iterate over a data table</title>
      <link>https://community.jmp.com/t5/Discussions/Quickest-way-to-iterate-over-a-data-table/m-p/903705#M106265</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt; is right, a matrix might improve the speed. Make sure you are using &amp;lt;&amp;lt;runformulas first; that might be fast enough.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = New Table( "Reprex",
    Add Rows( 1000000 ),
    New Column( "X", Numeric, Continuous, Formula( Random Integer( 0, 200 ) ) ),
    New Column( "Y", Numeric, Continuous, Formula( Random Integer( 0, 200 ) ) )
);

R_debut_X = 10;
largeur   = 50;
ecart_X   = 5;
debut_Y   = 20;
hauteur   = 30;
ecart_Y   = 5;
start = hptime();
// Slow way: row formula
dt &amp;lt;&amp;lt; New Column( "Zone_slow", Character,
    Formula(
        If( R_debut_X &amp;lt; :X &amp;lt;= R_debut_X + largeur &amp;amp; debut_Y &amp;lt; :Y &amp;lt;= debut_Y + hauteur, "Zone 1",
            R_debut_X + largeur + ecart_X &amp;lt; :X &amp;lt;= R_debut_X + 2*largeur + ecart_X &amp;amp; debut_Y &amp;lt; :Y &amp;lt;= debut_Y + hauteur, "Zone 2",
            "Other"
        )
    )
);
dt&amp;lt;&amp;lt;runformulas; // &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt; important &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;
stop=hptime();
show((stop-start)/1e6);// 1.3 sec

start = hptime();
dmatx = dt[0,{x}];
dmaty = dt[0,{y}];
cmatx1 = R_debut_X &amp;lt; dmatx &amp;lt;= R_debut_X + largeur;
cmaty1 = debut_Y &amp;lt; dmaty &amp;lt;= debut_Y + hauteur;
cmatxy1 = cmatx1 &amp;amp; cmaty1;
cmatx2 = R_debut_X + largeur + ecart_X &amp;lt; dmatx &amp;lt;= R_debut_X + 2*largeur + ecart_X;
cmaty2 = debut_Y &amp;lt; dmaty &amp;lt;= debut_Y + hauteur;
cmatxy2 = cmatx2 &amp;amp; cmaty2;
result = cmatxy1 + cmatxy2*2;
stop=hptime();
dt&amp;lt;&amp;lt;newcolumn("Zone_fast", values(result));
show((stop-start)/1e6);// .25 sec&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Craige_Hales_0-1758807317326.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/83489iE50BBC18E746B0D5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Craige_Hales_0-1758807317326.png" alt="Craige_Hales_0-1758807317326.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The result value is using the 0 or 1 truth value in cmatxy1,2 to build the 0, 1, or 2 value for other, zone1, zone2. You could probably collapse some of the matrix statements to make it still faster if that is important.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Sep 2025 13:41:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Quickest-way-to-iterate-over-a-data-table/m-p/903705#M106265</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2025-09-25T13:41:44Z</dc:date>
    </item>
    <item>
      <title>Re: Quickest way to iterate over a data table</title>
      <link>https://community.jmp.com/t5/Discussions/Quickest-way-to-iterate-over-a-data-table/m-p/904132#M106295</link>
      <description>&lt;P&gt;Thank you very much, it is mush faster now !&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Sep 2025 12:02:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Quickest-way-to-iterate-over-a-data-table/m-p/904132#M106295</guid>
      <dc:creator>SophieCuvillier</dc:creator>
      <dc:date>2025-09-26T12:02:59Z</dc:date>
    </item>
  </channel>
</rss>

