<?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: How do I join tables  based on one fully matching column and one closest matching? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-do-I-join-tables-based-on-one-fully-matching-column-and-one/m-p/450874#M69773</link>
    <description>&lt;P&gt;Why not just make a new column that round()s the time for the one with 8 digits and join upon that?&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;**Edit** Nevermind.&amp;nbsp; I immediately see why.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could get a subset of only the closest time by doing the following&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 = New Table( "Example",
	New Column( "Time",
		Set Values( [14.14, 14.28, 13.56, 13.11, 12.32, .] )
	)
);

dt &amp;lt;&amp;lt; New Column("Rounded Time", 
	Formula(Round(:Time, 0))
);

// we're just going to for the row that the value for time - rounded time = the min for that value
dt &amp;lt;&amp;lt; New Column("Closest", 
	Formula(
		Abs(:Time - :RoundedTime) == ColMin(Abs(:Time - :RoundedTime), :RoundedTime)
	)
);

&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 12 Jan 2022 16:03:25 GMT</pubDate>
    <dc:creator>vince_faller</dc:creator>
    <dc:date>2022-01-12T16:03:25Z</dc:date>
    <item>
      <title>How do I join tables  based on one fully matching column and one closest matching?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-join-tables-based-on-one-fully-matching-column-and-one/m-p/450846#M69771</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to join two data tables via the 'join' function in JMP. I would like to join them based on time and reactor number. However, this is not working as the column 'time' has 8 decimals in one of the data files and the other one zero decimals.&lt;/P&gt;&lt;P&gt;(How) would it be possible to match time on the closest matching point and reactor number exactly?&lt;/P&gt;&lt;P&gt;I've already found some older discussions about this problem. However, these solutions didn't work for me as a second column 'reactor number' could not be matched for.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture1.JPG" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/38940i6EF286383928DD46/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture1.JPG" alt="Capture1.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Here is a screenshot of the two data tables I would like to combine. The output should contain both time, reactor, reflectance and dry weight.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:42:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-join-tables-based-on-one-fully-matching-column-and-one/m-p/450846#M69771</guid>
      <dc:creator>Jekko</dc:creator>
      <dc:date>2023-06-10T23:42:28Z</dc:date>
    </item>
    <item>
      <title>Re: How do I join tables  based on one fully matching column and one closest matching?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-join-tables-based-on-one-fully-matching-column-and-one/m-p/450870#M69772</link>
      <description>&lt;P&gt;Could you provide small example datasets which have multiple reactors on both datatables (and in best case also table with correct results)? This might be possible to do by hand if there aren't too many groups and there is no need for automation. You could maybe use the fuzzy_merge addin and use lots of subsets to manage the bioreactor groups.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do also have a script (and tool) which should be able to do this, but &lt;STRONG&gt;I haven't had time to fully test it yet&lt;/STRONG&gt;, and I know for sure it still has some slight bugs. Join nearest rows tool should be able to:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Join based on distance&lt;/LI&gt;&lt;LI&gt;Join tables backwards, forwards and to nearest (with optional tie-breaker options)&lt;/LI&gt;&lt;LI&gt;Allow grouping&lt;/LI&gt;&lt;LI&gt;Allow using tolerance&lt;/LI&gt;&lt;LI&gt;Shouldn't require having sorted datatables&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_2-1642000994868.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/38943iF860A4C6FF59AD81/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_2-1642000994868.png" alt="jthi_2-1642000994868.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jan 2022 15:28:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-join-tables-based-on-one-fully-matching-column-and-one/m-p/450870#M69772</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-01-12T15:28:32Z</dc:date>
    </item>
    <item>
      <title>Re: How do I join tables  based on one fully matching column and one closest matching?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-join-tables-based-on-one-fully-matching-column-and-one/m-p/450874#M69773</link>
      <description>&lt;P&gt;Why not just make a new column that round()s the time for the one with 8 digits and join upon that?&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;**Edit** Nevermind.&amp;nbsp; I immediately see why.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could get a subset of only the closest time by doing the following&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 = New Table( "Example",
	New Column( "Time",
		Set Values( [14.14, 14.28, 13.56, 13.11, 12.32, .] )
	)
);

dt &amp;lt;&amp;lt; New Column("Rounded Time", 
	Formula(Round(:Time, 0))
);

// we're just going to for the row that the value for time - rounded time = the min for that value
dt &amp;lt;&amp;lt; New Column("Closest", 
	Formula(
		Abs(:Time - :RoundedTime) == ColMin(Abs(:Time - :RoundedTime), :RoundedTime)
	)
);

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Jan 2022 16:03:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-join-tables-based-on-one-fully-matching-column-and-one/m-p/450874#M69773</guid>
      <dc:creator>vince_faller</dc:creator>
      <dc:date>2022-01-12T16:03:25Z</dc:date>
    </item>
    <item>
      <title>Re: How do I join tables  based on one fully matching column and one closest matching?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-join-tables-based-on-one-fully-matching-column-and-one/m-p/450881#M69777</link>
      <description>&lt;P&gt;Thanks for your reply! I will upload a small example yes.&lt;/P&gt;&lt;P&gt;I've once tried to do it manually but it took so long as there are up to 24 groups/reactors and you'll need to scroll through a lot of time points. Creating subsets? How would you see that working?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jan 2022 16:58:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-join-tables-based-on-one-fully-matching-column-and-one/m-p/450881#M69777</guid>
      <dc:creator>Jekko</dc:creator>
      <dc:date>2022-01-12T16:58:25Z</dc:date>
    </item>
    <item>
      <title>Re: How do I join tables  based on one fully matching column and one closest matching?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-join-tables-based-on-one-fully-matching-column-and-one/m-p/450894#M69779</link>
      <description>&lt;P&gt;Does the example dataset you provided have wrong values matched?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Create column dry weight g/l and rename Time h to time h in reflectance data:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_2-1642007496381.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/38950iD77DE4CC4E6ACD37/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_2-1642007496381.png" alt="jthi_2-1642007496381.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Concatenate the dry weight data to that:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_1-1642007367227.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/38949i7A6235BB0E46F789/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_1-1642007367227.png" alt="jthi_1-1642007367227.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Select reactor and Time h column and Sort by them.&lt;/P&gt;&lt;P&gt;Select missing value in dry weight -&amp;gt; select matching cells -&amp;gt; invert selection&lt;/P&gt;&lt;P&gt;Now you can jump around the table to find closest values:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_3-1642007574151.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/38951iE02F7FABACD5476C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_3-1642007574151.png" alt="jthi_3-1642007574151.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;At this point you could create some helping formulas or scripts to calculate the nearest value for example something like this to further reduce the data:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
dt = Current Data Table();
r = dt &amp;lt;&amp;lt; Get Selected Rows; //selecting of wanted rows could be done in script instead of datatable
r_min = r - 1;
r_max = r + 1;
dt &amp;lt;&amp;lt; Subset(rows(Sort List(r||r_min||r_max)), Selected Columns(0));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_8-1642008350940.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/38956iE82475BFF65AEA7C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_8-1642008350940.png" alt="jthi_8-1642008350940.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;At this point you could most likely copy-paste the dry weight time values to new column and create formula to calculate closest row.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_9-1642008571936.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/38957iEEA2DB87A8D56D1B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_9-1642008571936.png" alt="jthi_9-1642008571936.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what join nearest rows would return when Join is used:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_4-1642007727491.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/38952i5EDF1D35FCAD193E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_4-1642007727491.png" alt="jthi_4-1642007727491.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;With Update it wont create as many messy columns:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_10-1642008595468.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/38958i3D589C81355C1CCA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_10-1642008595468.png" alt="jthi_10-1642008595468.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;UI of the tools seems to have some problem on table selection... and user has to make sure correct tables or selected or the tool will do self-join.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jan 2022 17:30:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-join-tables-based-on-one-fully-matching-column-and-one/m-p/450894#M69779</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-01-12T17:30:28Z</dc:date>
    </item>
  </channel>
</rss>

