<?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 How to combine data measured in different units in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-combine-data-measured-in-different-units/m-p/383842#M63438</link>
    <description>&lt;P&gt;I have a JMP Table that contains data measured hourly at about 50 different stations.&amp;nbsp; At each station the data is sometimes reported in ppm, other times in ppb, occasionally in both units and occasionally, there are no measurements at all.&amp;nbsp; It's a pretty large dataset and I'm wondering - how do I automate combining the columns that pertain to each station into a single column in one system of units.&amp;nbsp; Or do I have to manually create a new column for each station and enter a formula to do the conversion? I'm just trying to speed up this data prep step without using Excel.&lt;/P&gt;</description>
    <pubDate>Sat, 10 Jun 2023 23:30:04 GMT</pubDate>
    <dc:creator>Ese_Omatsone</dc:creator>
    <dc:date>2023-06-10T23:30:04Z</dc:date>
    <item>
      <title>How to combine data measured in different units</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-combine-data-measured-in-different-units/m-p/383842#M63438</link>
      <description>&lt;P&gt;I have a JMP Table that contains data measured hourly at about 50 different stations.&amp;nbsp; At each station the data is sometimes reported in ppm, other times in ppb, occasionally in both units and occasionally, there are no measurements at all.&amp;nbsp; It's a pretty large dataset and I'm wondering - how do I automate combining the columns that pertain to each station into a single column in one system of units.&amp;nbsp; Or do I have to manually create a new column for each station and enter a formula to do the conversion? I'm just trying to speed up this data prep step without using Excel.&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:30:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-combine-data-measured-in-different-units/m-p/383842#M63438</guid>
      <dc:creator>Ese_Omatsone</dc:creator>
      <dc:date>2023-06-10T23:30:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine data measured in different units</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-combine-data-measured-in-different-units/m-p/383851#M63439</link>
      <description>&lt;P&gt;A very simple script can be used to change the values directly in the column it came in.&amp;nbsp; Or you can use the Recode tool to do the same, in an interactive format.&amp;nbsp; How do you determine what the units of measurement are?&amp;nbsp; Is there a separate column that indicates that?&lt;/P&gt;</description>
      <pubDate>Mon, 10 May 2021 18:53:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-combine-data-measured-in-different-units/m-p/383851#M63439</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-05-10T18:53:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine data measured in different units</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-combine-data-measured-in-different-units/m-p/383878#M63442</link>
      <description>&lt;P&gt;Does the data appear as numeric (without the units - or units in a separate field) or as character data where the units appear with the number (e.g., 13ppm)?&amp;nbsp; It would be easier if you can provide an example of how the data appears.&amp;nbsp; A formula should make the conversion you want, but exactly what formula depends on what the data looks like.&lt;/P&gt;</description>
      <pubDate>Mon, 10 May 2021 19:18:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-combine-data-measured-in-different-units/m-p/383878#M63442</guid>
      <dc:creator>dale_lehman</dc:creator>
      <dc:date>2021-05-10T19:18:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine data measured in different units</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-combine-data-measured-in-different-units/m-p/383985#M63444</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture_2.PNG" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/32727i824F1EAA8CE3FFF5/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture_2.PNG" alt="Capture_2.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 May 2021 21:08:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-combine-data-measured-in-different-units/m-p/383985#M63444</guid>
      <dc:creator>Ese_Omatsone</dc:creator>
      <dc:date>2021-05-10T21:08:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine data measured in different units</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-combine-data-measured-in-different-units/m-p/383986#M63445</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what the data looks like.&amp;nbsp; The column name says the station and the units for the measurement.&lt;/P&gt;&lt;P&gt;Thank you kindly for the help.&lt;/P&gt;</description>
      <pubDate>Mon, 10 May 2021 21:09:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-combine-data-measured-in-different-units/m-p/383986#M63445</guid>
      <dc:creator>Ese_Omatsone</dc:creator>
      <dc:date>2021-05-10T21:09:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine data measured in different units</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-combine-data-measured-in-different-units/m-p/384019#M63452</link>
      <description>&lt;P&gt;Hi Jim,&lt;/P&gt;&lt;P&gt;I posted a picture of that the data looks like, in answer to your question.&amp;nbsp; Please tell me the steps to change the data in place.&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 10 May 2021 22:07:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-combine-data-measured-in-different-units/m-p/384019#M63452</guid>
      <dc:creator>Ese_Omatsone</dc:creator>
      <dc:date>2021-05-10T22:07:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine data measured in different units</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-combine-data-measured-in-different-units/m-p/384027#M63453</link>
      <description>&lt;P&gt;No doubt there are many ways to do this, here is the first that came to mind assuming the column format in your example is consistent. You can either run the script at the bottom of the post to see a full example or follow along with the green comments in the script and the screenshots below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bring all station data into a single column using Stack:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ih_0-1620684493672.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/32728i6380C57EB621F6EB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ih_0-1620684493672.png" alt="ih_0-1620684493672.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Formula for Station (shown both in the 'pretty' format and the code you get when double clicking on the formula:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ih_2-1620684601350.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/32730i7F0E7332A311B795/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ih_2-1620684601350.png" alt="ih_2-1620684601350.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Formula for Unit is similar:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ih_3-1620684619132.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/32731iB2E4C1D810ABC551/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ih_3-1620684619132.png" alt="ih_3-1620684619132.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Formula for Data accounts for each potential unit:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ih_5-1620684651969.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/32733i0F2F5214DC6D8F1F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ih_5-1620684651969.png" alt="ih_5-1620684651969.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Tabulate relies on the ordinal or nominal data type for Intervals and Station:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ih_6-1620684698459.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/32734i88742F4F9B9784E4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ih_6-1620684698459.png" alt="ih_6-1620684698459.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Then use Make Into Data table from the tabulate menu.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Script to recreate an example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;//To see a full example you can copy this this into a new script window and press Run, or just following along
//with the green comments

Names default to here(1);

//Recreate part of your sample data table, you could skip this part and open your original data instead
//Note that the times are ordinal or nominal data types, this will be imporant in the tabulate platform later
dt = New Table( "Raw Data",
	Add Rows( 2 ),
	New Column( "IntervalStart", Numeric, "Ordinal", Format( "m/d/y h:m", 19 ), Input Format( "m/d/y" ),
		Set Values( [3503606400, 3503610000] ),
	),
	New Column( "IntervalEnd", Numeric, "Ordinal", Format( "m/d/y h:m", 19 ), Input Format( "m/d/y h:m" ),
		Set Values( [3503609940, 3503613540] )
	),
	New Column( "StationName: Anzac-Unit:ppb", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [1, 2] ) ),
	New Column( "StationName: Anzac-Unit:ppm", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [., .] ) ),
	New Column( "StationName: Ardrossan-Unit: ppb", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [., .] ) ),
	New Column( "StationName: Ardrossan-Unit: ppm", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [11, 12] ) )
);

//Get a reference to your current data table
dt = Current data table();

//Stack all of the columns - use Tables &amp;gt; Stack and include all of the columns except the first two which are times
dtStacked = dt &amp;lt;&amp;lt; Stack(
	columns(
		(dt &amp;lt;&amp;lt; Get Column Names())[3::n col(dt)]
	),
	Source Label Column( "Label" ),
	Stacked Data Column( "Data" )
);

//Now add three new columns to find the station and units, and calculate the concentration based on the units 
//you should be able to copy and paste the part inside the 'Formula' function below into the formulas of your new columns
dtStacked &amp;lt;&amp;lt; New Column("Station", Character, "Nominal", Formula(Words(:Label, "-")[1]));
dtStacked &amp;lt;&amp;lt; New Column("Unit", Character, "Nominal", Formula(Words(:Label, "-")[2]), Set Display Width(65));
dtStacked &amp;lt;&amp;lt; New Column("Data (ppm)", Numeric, "Continuous", Format("Best", 12), Formula(If(Contains(:Unit, "ppm"), :Data, Contains(:Unit, "ppb"), :Data / 1000)));

//Put back in standard format using the tabulate platform.  Drag times and the station into 
//columns on the left and add the mean and N as data fields.  Note that in the resulting table anything 
//with a N(Data) greater than 1 might have a problem!
(dtStacked &amp;lt;&amp;lt; Tabulate(
	Show Control Panel( 0 ),
	Add Table(
		Column Table( Analysis Columns( :Data ), Statistics( Mean, N ) ),
		Row Table( Grouping Columns( :IntervalStart, :IntervalEnd, :Station ) )
	)
)) &amp;lt;&amp;lt; Make Into Data Table;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 May 2021 22:13:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-combine-data-measured-in-different-units/m-p/384027#M63453</guid>
      <dc:creator>ih</dc:creator>
      <dc:date>2021-05-10T22:13:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine data measured in different units</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-combine-data-measured-in-different-units/m-p/384028#M63454</link>
      <description>&lt;P&gt;Here is a script that given the structure you showed, will give convert all of the data to ppm and delete the ppb columns&lt;/P&gt;
&lt;P&gt;It is just the starting point, and if more specifics change the calculations, they can be included in the logic&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Current Data Table();
For( i = 1, i &amp;lt;= N Cols( dt ), i++,
	If( Trim( Word( -1, Column( dt, i ) &amp;lt;&amp;lt; get name, ":" ) ) == "ppm",
		ppbCol = Trim( Substr( Column( dt, i ) &amp;lt;&amp;lt; get name, 1, Contains( Column( dt, i ) &amp;lt;&amp;lt; get name, "ppm" ) - 1 ) || "ppb" );
		For( k = 1, k &amp;lt;= N Rows( dt ), k++,
			Column( dt, i )[k] = Sum( Column( dt, i )[k], Column( dt, ppbCol )[k]/1000 )
		);
	)
);

// Get rid of ppb columns
For( i = N Cols( dt ), i &amp;gt;= 1, i--,
	If( Trim( Word( -1, Column( dt, i ) &amp;lt;&amp;lt; get name, ":" ) ) == "ppb",
		dt &amp;lt;&amp;lt; delete columns( i )
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 May 2021 22:43:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-combine-data-measured-in-different-units/m-p/384028#M63454</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-05-10T22:43:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine data measured in different units</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-combine-data-measured-in-different-units/m-p/384031#M63456</link>
      <description>&lt;P&gt;THANK YOU.&amp;nbsp; IT WORKED!&amp;nbsp; Everything is now in ppm, and I can continue with my analysis.&lt;/P&gt;</description>
      <pubDate>Mon, 10 May 2021 23:09:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-combine-data-measured-in-different-units/m-p/384031#M63456</guid>
      <dc:creator>Ese_Omatsone</dc:creator>
      <dc:date>2021-05-10T23:09:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine data measured in different units</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-combine-data-measured-in-different-units/m-p/384032#M63457</link>
      <description>&lt;P&gt;Thank you kindly!&lt;/P&gt;</description>
      <pubDate>Mon, 10 May 2021 23:12:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-combine-data-measured-in-different-units/m-p/384032#M63457</guid>
      <dc:creator>Ese_Omatsone</dc:creator>
      <dc:date>2021-05-10T23:12:18Z</dc:date>
    </item>
  </channel>
</rss>

