<?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: Subset with added formula column - almost there in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Subset-with-added-formula-column-almost-there/m-p/388603#M63869</link>
    <description>&lt;P&gt;Thank you so much!! The first solution worked perfectly. I'm sure you hear this all the time, but you are a life saver!&lt;/P&gt;</description>
    <pubDate>Wed, 26 May 2021 21:39:32 GMT</pubDate>
    <dc:creator>wendy1123</dc:creator>
    <dc:date>2021-05-26T21:39:32Z</dc:date>
    <item>
      <title>Subset with added formula column - almost there</title>
      <link>https://community.jmp.com/t5/Discussions/Subset-with-added-formula-column-almost-there/m-p/388454#M63855</link>
      <description>&lt;P&gt;I am trying to create a script to subset data which also adds a column with a formula in it. I am close (sort of). I can create the subset, with the new column, but the new column only has dots in it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is what I have so far:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Data Table( "Melt Curve Raw Data" ) &amp;lt;&amp;lt; Subset(
	By( :Well Position ),
	All rows,
	Selected columns only( 0 ),
	columns( :Temperature, :Fluorescence,  New Column( "Normalized Fluorescence", formula(
	(:Fluorescence - Col Min(:Fluorescence )) / (Col Max(:Fluorescence )
	-Col Min(:Fluorescence )))
	))
	);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;After searching, I saw something about an eval command, but as a beginner I can't figure out how to add it in so it works.&lt;/P&gt;&lt;P&gt;**Ideally I would also be able to add the new column directly after the Temperature column instead of at the end&lt;/P&gt;&lt;P&gt;Thank you in advance for any advice!!&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:30:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Subset-with-added-formula-column-almost-there/m-p/388454#M63855</guid>
      <dc:creator>wendy1123</dc:creator>
      <dc:date>2023-06-10T23:30:44Z</dc:date>
    </item>
    <item>
      <title>Re: Subset with added formula column - almost there</title>
      <link>https://community.jmp.com/t5/Discussions/Subset-with-added-formula-column-almost-there/m-p/388482#M63857</link>
      <description>&lt;P&gt;New Column() is not permitted in the column specification for Subset().&amp;nbsp; At least I can not find such in the documentation, nor does it work in a very simple subset example, with it included.&amp;nbsp; Therefore, I have modified your script to create the column in the original data table, then subset the tables and then go back and delete it from the original table.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Data Table( "Melt Curve Raw Data" ) &amp;lt;&amp;lt;
New Column( "Normalized Fluorescence",
	formula(
		(:Fluorescence - Col Min( :Fluorescence )) / (
		Col Max( :Fluorescence ) - Col Min( :Fluorescence ))
	)
);
	
Data Table( "Melt Curve Raw Data" ) &amp;lt;&amp;lt;
Subset(
	By( :Well Position ),
	All rows,
	Selected columns only( 0 ),
	columns( :Temperature, :Fluorescence, :Normalized Fluorescence )
);
	
Data Table( "Melt Curve Raw Data" ) &amp;lt;&amp;lt;
delete columns( :Normalized Fluorescence );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 26 May 2021 12:04:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Subset-with-added-formula-column-almost-there/m-p/388482#M63857</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-05-26T12:04:13Z</dc:date>
    </item>
    <item>
      <title>Re: Subset with added formula column - almost there</title>
      <link>https://community.jmp.com/t5/Discussions/Subset-with-added-formula-column-almost-there/m-p/388592#M63865</link>
      <description>&lt;P&gt;Hi Jim! Thank you for your advice. I wish I could use your method, but unfortunately, when I add the column before doing the subsets, the new column uses the previous max &amp;amp; mins so the calculations are wrong.&lt;BR /&gt;&lt;BR /&gt;Adding the new column after the subset works for me, not sure why, and it is correctly titled, but the formula doesn't "calculate" which is why I thought it might be the "eval" thing I've seen. When I go into the new columns, it has "suppress eval" on but I don't know how to fix that without going in by hand to all of the subsets and correcting it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I attached a screenshot of what it looks like to me. The column appears, but with the dots. When I go into column info, it has the "suppress eval" checked, and unchecking it solves the error, but it's not ideal to have to go into all of the subsets individually to uncheck the box. I tried adding different codes to the script to turn off suppress eval, but none of them work so far.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jmp new column eval error.JPG" style="width: 391px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/33089i00E1E57C6619EA2C/image-dimensions/391x251?v=v2" width="391" height="251" role="button" title="jmp new column eval error.JPG" alt="jmp new column eval error.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 26 May 2021 23:39:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Subset-with-added-formula-column-almost-there/m-p/388592#M63865</guid>
      <dc:creator>wendy1123</dc:creator>
      <dc:date>2021-05-26T23:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: Subset with added formula column - almost there</title>
      <link>https://community.jmp.com/t5/Discussions/Subset-with-added-formula-column-almost-there/m-p/388595#M63866</link>
      <description>&lt;P&gt;Here are 2 solutions to the issue.&amp;nbsp; The first one changes the calculation to use the min and max values for the particular Well Position that is being evaluated.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Data Table( "Melt Curve Raw Data" ) &amp;lt;&amp;lt; New Column( "Normalized Fluorescence",
	formula(
		(:Fluorescence - Col Min( :Fluorescence, :Well Position )) / (
		Col Max( :Fluorescence, :Well Position )
		-Col Min( :Fluorescence, :Well Position ))
	)
);
	
Data Table( "Melt Curve Raw Data" ) &amp;lt;&amp;lt; Subset(
	By( :Well Position ),
	All rows,
	Selected columns only( 0 ),
	columns( :Temperature, :Fluorescence, :Normalized Fluorescence )
);
	
Data Table( "Melt Curve Raw Data" ) &amp;lt;&amp;lt; delete columns( :Normalized Fluorescence );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The second one creates the subsetted data tables, and then goes back and add the new column for each of the new data tables produced&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;new tables = Data Table( "Melt Curve Raw Data" ) &amp;lt;&amp;lt;
Subset(
	By( :Well Position ),
	All rows,
	Selected columns only( 0 ),
	columns( :Temperature, :Fluorescence, :Normalized Fluorescence )
);
	
For( i = 1, i &amp;lt;= N Items( new tables ), i++,
	new tables[i] &amp;lt;&amp;lt; New Column( "Normalized Fluorescence",
		formula(
			(:Fluorescence - Col Min( :Fluorescence, :Well Position )) / (
			Col Max( :Fluorescence, :Well Position )
			-Col Min( :Fluorescence, :Well Position ))
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 26 May 2021 21:02:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Subset-with-added-formula-column-almost-there/m-p/388595#M63866</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-05-26T21:02:12Z</dc:date>
    </item>
    <item>
      <title>Re: Subset with added formula column - almost there</title>
      <link>https://community.jmp.com/t5/Discussions/Subset-with-added-formula-column-almost-there/m-p/388603#M63869</link>
      <description>&lt;P&gt;Thank you so much!! The first solution worked perfectly. I'm sure you hear this all the time, but you are a life saver!&lt;/P&gt;</description>
      <pubDate>Wed, 26 May 2021 21:39:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Subset-with-added-formula-column-almost-there/m-p/388603#M63869</guid>
      <dc:creator>wendy1123</dc:creator>
      <dc:date>2021-05-26T21:39:32Z</dc:date>
    </item>
  </channel>
</rss>

