<?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: the new Where? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/the-new-Where/m-p/769150#M94965</link>
    <description>&lt;P&gt;Thanks for the insights and the&amp;nbsp;trick via Mask&amp;nbsp; - much faster than&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Where( xs[0,1] ==10 &amp;amp; xs[0,2] ==20 );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;... but no chance to beat &lt;FONT face="courier new,courier"&gt;Loc&lt;/FONT&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;kind of surprising ...&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_0-1719563594429.png" style="width: 585px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/65676i95959B383B2C5542/image-dimensions/585x120?v=v2" width="585" height="120" role="button" title="hogi_0-1719563594429.png" alt="hogi_0-1719563594429.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 18 Jul 2025 20:19:05 GMT</pubDate>
    <dc:creator>hogi</dc:creator>
    <dc:date>2025-07-18T20:19:05Z</dc:date>
    <item>
      <title>the new Where?</title>
      <link>https://community.jmp.com/t5/Discussions/the-new-Where/m-p/769031#M94941</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how can I use the new Where function with lists of lists or matrices?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;xs = {10, 20, 30, 50};
Where( Print(xs); xs ==10 );

xs = {[10 20], [30 50]};
Where( Print(xs); xs ==[10 20] );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Jun 2024 18:00:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/the-new-Where/m-p/769031#M94941</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2024-06-27T18:00:03Z</dc:date>
    </item>
    <item>
      <title>Re: the new Where?</title>
      <link>https://community.jmp.com/t5/Discussions/the-new-Where/m-p/769053#M94945</link>
      <description>&lt;P&gt;on the first one&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;xs = {10, 20, 30, 50};
v=Where( xs ==10 );
print(v);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I am not sure of the second one&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2024 18:29:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/the-new-Where/m-p/769053#M94945</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-06-27T18:29:36Z</dc:date>
    </item>
    <item>
      <title>Re: the new Where?</title>
      <link>https://community.jmp.com/t5/Discussions/the-new-Where/m-p/769068#M94948</link>
      <description>&lt;P&gt;The first one was meant as working example :)&lt;/img&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;Print&lt;/FONT&gt; inside &lt;FONT face="courier new,courier"&gt;Where&lt;/FONT&gt;:&lt;BR /&gt;to show that &lt;FONT face="courier new,courier"&gt;xs&lt;/FONT&gt; indeed refers to each individual element during the loop.&lt;BR /&gt;[wow! - but explains the easy syntax]&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;"refers to each individual element"&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;... actually like in the second example.&lt;/P&gt;&lt;P&gt;Which makes me wonder about the second result -&amp;nbsp;&lt;FONT face="courier new,courier"&gt;xs&lt;/FONT&gt; &lt;U&gt;is&lt;/U&gt; &lt;FONT face="courier new,courier"&gt;[10 20]&lt;/FONT&gt;, but &lt;FONT face="courier new,courier"&gt;Where&lt;/FONT&gt; doesn't find the match.&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="hogi_0-1719514495334.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/65668i1B6A3C9C1C2DE06A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_0-1719514495334.png" alt="hogi_0-1719514495334.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2024 18:58:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/the-new-Where/m-p/769068#M94948</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2024-06-27T18:58:14Z</dc:date>
    </item>
    <item>
      <title>Re: the new Where?</title>
      <link>https://community.jmp.com/t5/Discussions/the-new-Where/m-p/769137#M94961</link>
      <description>&lt;P&gt;If you were to add one more item to your list, Where will break. I cannot really understand the error message&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Not all sequences are the same size in access or evaluation of 'Where' , Bad Argument(
	Print(xs);
	xs == [10 20];
), Where/*###*/(Print(xs) ; xs == [10 20])
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&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);

xs = {[10 20], [30 50], [10 20]};
Where(
	Print(xs);
	xs == [10 20];
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Other example in the Scripting Index seems to be closest to this, but using index 1 doesn't really work in this case.&lt;/P&gt;
&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/11257"&gt;@EvanMcCorkle&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you make a simple comparison like&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);

xs = {[10 20], [30 50], [10 20]};
mask = Repeat(Eval List({[10 20]}), N Items(xs));
xs[1] == mask[1];&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;you won't get back 1, you will get back [1 1] (so one for each match). You should be able to convert this to 1 using All, but Where doesn't like that either (it seems to only compare first item in the matrix?)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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);

xs = {[10 20], [30 20]};

Where(Show(xs == [10 20]));&amp;nbsp;//&amp;nbsp;[1&amp;nbsp;0]&amp;nbsp;and&amp;nbsp;[0&amp;nbsp;1]&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you try with xs[1], it will work until you add third item (or remove one) so most likely it is comparing wrong thing&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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);

xs = {[10 20], [30 20]};

r = Where(
	Show(xs[1] == [10 20]);
	xs[1] == [10 20];
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Finally with a lot of trial, error and guess work this worked at least from time to time (not really sure if you want to create large matrices for a mask). This isn't what you would expect from Where() to be for this type of comparisons unless it is documented properly&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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);

xs = {[10 20], [30 20], [10 20]};
mask = Repeat(Eval List({[10 20]}), N Items(xs));

r = Where(
	//show(xs, mask, xs == mask, All(xs == mask));
	All(xs == mask);
);
&lt;/CODE&gt;&lt;CODE class=" language-jsl"&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also doing it this way seems to be slower than just using Loc() but my test might be flawed&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
testitems = 300;
//xs = {[10 20], [30 20], [10 20]};
xs = Repeat({[10 20]}, testitems / 3);
xs = xs || Repeat({[30 20]}, testitems / 3);
xs = xs || Repeat({[1 2]}, testitems / 3);
xs = xs[Random Shuffle(1::testitems)];


testcount = 10000;

where_speed = Repeat({.}, testcount);
loc_speed = Repeat({.}, testcount);
matches = Repeat({.}, testcount);
category = Repeat({""}, testcount);


expr1 = Expr(
	wait(0);	
	a = HP Time();
	mask = Repeat(Eval List({[10 20]}), N Items(xs));
	r1 = Where(All(xs == mask));
	wait(0);
	b = HP Time();
);

expr2 = Expr(
	wait(0);
	
	c = HP Time();
	r2 = Loc(xs, [10 20]);
	wait(0);
	d = HP Time();	
);

For(i = 1, i &amp;lt;= testcount, i++,
	wait(0);
	If(Random Integer(1, 2) == 2,
		expr2;
		expr1;
		cur_cat = "Loc";
	,
		expr1;
		expr2;
		cur_cat = "Where";
	);
	
	where_speed[i] = b - a;
	loc_speed[i] = d - c;
	category[i] = "Loc";
	matches[i] = Try(All(r1 == r2), 0);
	
	wait(0);
);

dt = New Table("Test",
	Add Rows(testcount),
	New Column("Row", Numeric, Ordinal, Formula(Row())),
	New Column("Locs", Numeric, Continuous, Values(loc_speed)),
	New Column("Where", Numeric, Continuous, Values(where_speed)),
	New Column("Matches", Numeric, Nominal, Values(matches)),
	New Column("Category", Character, Nominal, Values(category))
);

tab = dt &amp;lt;&amp;lt; Tabulate(
	Show Control Panel(0),
	Add Table(
		Column Table(Analysis Columns(:Locs, :Where)),
		Row Table(
			Grouping Columns(:Category),
			Statistics(Mean, Median, Std Dev, Interquartile Range)
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI-SPOILER&gt;</description>
      <pubDate>Fri, 28 Jun 2024 07:15:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/the-new-Where/m-p/769137#M94961</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-06-28T07:15:39Z</dc:date>
    </item>
    <item>
      <title>Re: the new Where?</title>
      <link>https://community.jmp.com/t5/Discussions/the-new-Where/m-p/769150#M94965</link>
      <description>&lt;P&gt;Thanks for the insights and the&amp;nbsp;trick via Mask&amp;nbsp; - much faster than&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Where( xs[0,1] ==10 &amp;amp; xs[0,2] ==20 );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;... but no chance to beat &lt;FONT face="courier new,courier"&gt;Loc&lt;/FONT&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;kind of surprising ...&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_0-1719563594429.png" style="width: 585px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/65676i95959B383B2C5542/image-dimensions/585x120?v=v2" width="585" height="120" role="button" title="hogi_0-1719563594429.png" alt="hogi_0-1719563594429.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jul 2025 20:19:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/the-new-Where/m-p/769150#M94965</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2025-07-18T20:19:05Z</dc:date>
    </item>
    <item>
      <title>Re: the new Where?</title>
      <link>https://community.jmp.com/t5/Discussions/the-new-Where/m-p/888066#M105025</link>
      <description>&lt;P&gt;Ran into the same error:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Not all sequences are the same size in access or evaluation of 'Where' , Bad Argument
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This time when using the "Contains" function. The same argument works as expected when used inside the "Get Rows Where" function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a minimal example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
names = {"KATIE", "JAMES"};
r1 = dt &amp;lt;&amp;lt; Get Rows Where( Contains(names, :name) );
r2 = Where( Contains(names, :name) );
Show( r1, r2 );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;r1 works, r2 will throw the error.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jul 2025 20:07:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/the-new-Where/m-p/888066#M105025</guid>
      <dc:creator>simopod</dc:creator>
      <dc:date>2025-07-18T20:07:42Z</dc:date>
    </item>
  </channel>
</rss>

