<?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 do we filter data based on time and take the average using JSL? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-do-we-filter-data-based-on-time-and-take-the-average-using/m-p/342845#M59194</link>
    <description>&lt;P&gt;I have data captured for a particular duration of time. Please find below snapshot of the table (attached the same):&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;TimeStamp&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;A&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;B&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;C&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0.001&lt;/TD&gt;&lt;TD&gt;10.005&lt;/TD&gt;&lt;TD&gt;450.4451&lt;/TD&gt;&lt;TD&gt;428.9093&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0.002&lt;/TD&gt;&lt;TD&gt;10.01&lt;/TD&gt;&lt;TD&gt;450.8904&lt;/TD&gt;&lt;TD&gt;429.0295&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0.003&lt;/TD&gt;&lt;TD&gt;10.015&lt;/TD&gt;&lt;TD&gt;451.336&lt;/TD&gt;&lt;TD&gt;429.0177&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0.004&lt;/TD&gt;&lt;TD&gt;10.02&lt;/TD&gt;&lt;TD&gt;451.7818&lt;/TD&gt;&lt;TD&gt;428.9279&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0.005&lt;/TD&gt;&lt;TD&gt;10.025&lt;/TD&gt;&lt;TD&gt;452.2278&lt;/TD&gt;&lt;TD&gt;428.8491&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The plot of column C looks like below:&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="time_avg.jpg" style="width: 695px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/29022i12170E3B274174C4/image-dimensions/695x358?v=v2" width="695" height="358" role="button" title="time_avg.jpg" alt="time_avg.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I need to filter the rows in section1 , 2 &amp;amp; 3 and find their average.&lt;/P&gt;&lt;P&gt;Each section spans for 30second duration which is calculated from timestamp column&amp;nbsp; and there is a 20 second interval between each section.&lt;BR /&gt;The final result table should be as below:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Section&lt;/TD&gt;&lt;TD&gt;mean(A)&lt;/TD&gt;&lt;TD&gt;mean(B)&lt;/TD&gt;&lt;TD&gt;mean(C)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;10.005&lt;/TD&gt;&lt;TD&gt;450.4451&lt;/TD&gt;&lt;TD&gt;428.9093&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;10.01&lt;/TD&gt;&lt;TD&gt;450.8904&lt;/TD&gt;&lt;TD&gt;429.0295&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;10.015&lt;/TD&gt;&lt;TD&gt;451.336&lt;/TD&gt;&lt;TD&gt;429.0177&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;Could you please advise how can we&amp;nbsp;filter the rows in section1 , 2 &amp;amp; 3 and find their average using script.&lt;/P&gt;</description>
    <pubDate>Sat, 10 Jun 2023 23:23:53 GMT</pubDate>
    <dc:creator>jojmp</dc:creator>
    <dc:date>2023-06-10T23:23:53Z</dc:date>
    <item>
      <title>How do we filter data based on time and take the average using JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-we-filter-data-based-on-time-and-take-the-average-using/m-p/342845#M59194</link>
      <description>&lt;P&gt;I have data captured for a particular duration of time. Please find below snapshot of the table (attached the same):&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;TimeStamp&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;A&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;B&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;C&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0.001&lt;/TD&gt;&lt;TD&gt;10.005&lt;/TD&gt;&lt;TD&gt;450.4451&lt;/TD&gt;&lt;TD&gt;428.9093&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0.002&lt;/TD&gt;&lt;TD&gt;10.01&lt;/TD&gt;&lt;TD&gt;450.8904&lt;/TD&gt;&lt;TD&gt;429.0295&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0.003&lt;/TD&gt;&lt;TD&gt;10.015&lt;/TD&gt;&lt;TD&gt;451.336&lt;/TD&gt;&lt;TD&gt;429.0177&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0.004&lt;/TD&gt;&lt;TD&gt;10.02&lt;/TD&gt;&lt;TD&gt;451.7818&lt;/TD&gt;&lt;TD&gt;428.9279&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0.005&lt;/TD&gt;&lt;TD&gt;10.025&lt;/TD&gt;&lt;TD&gt;452.2278&lt;/TD&gt;&lt;TD&gt;428.8491&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The plot of column C looks like below:&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="time_avg.jpg" style="width: 695px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/29022i12170E3B274174C4/image-dimensions/695x358?v=v2" width="695" height="358" role="button" title="time_avg.jpg" alt="time_avg.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I need to filter the rows in section1 , 2 &amp;amp; 3 and find their average.&lt;/P&gt;&lt;P&gt;Each section spans for 30second duration which is calculated from timestamp column&amp;nbsp; and there is a 20 second interval between each section.&lt;BR /&gt;The final result table should be as below:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Section&lt;/TD&gt;&lt;TD&gt;mean(A)&lt;/TD&gt;&lt;TD&gt;mean(B)&lt;/TD&gt;&lt;TD&gt;mean(C)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;10.005&lt;/TD&gt;&lt;TD&gt;450.4451&lt;/TD&gt;&lt;TD&gt;428.9093&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;10.01&lt;/TD&gt;&lt;TD&gt;450.8904&lt;/TD&gt;&lt;TD&gt;429.0295&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;10.015&lt;/TD&gt;&lt;TD&gt;451.336&lt;/TD&gt;&lt;TD&gt;429.0177&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;Could you please advise how can we&amp;nbsp;filter the rows in section1 , 2 &amp;amp; 3 and find their average using script.&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:23:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-we-filter-data-based-on-time-and-take-the-average-using/m-p/342845#M59194</guid>
      <dc:creator>jojmp</dc:creator>
      <dc:date>2023-06-10T23:23:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do we filter data based on time and take the average using JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-we-filter-data-based-on-time-and-take-the-average-using/m-p/342871#M59200</link>
      <description>&lt;P&gt;Here is how I would do it.&amp;nbsp; It does not match your results, but it does follow the directions you indicated, calculating the Section based upon the TimeStamp values of 0-30 = Section 1, 50-80 = Section 2, 100-130 = Section 3&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="section.PNG" style="width: 603px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/29024iB0CC2D14B7FC3FFF/image-size/large?v=v2&amp;amp;px=999" role="button" title="section.PNG" alt="section.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
dt=current data table();
dt &amp;lt;&amp;lt; new column("Section",
	ordinal,
	formula(
		If( 0 &amp;lt;= :TimeStamp &amp;lt;= 30,
			1,
			50 &amp;lt;= :TimeStamp &amp;lt;= 80,
			2,
			100 &amp;lt;= :TimeStamp &amp;lt;= 130,
			3
		)
	)
);

dt &amp;lt;&amp;lt; Summary(
	Group( :Section ),
	Mean( :A ),
	Mean( :B ),
	Mean( :C ),
	Freq( "None" ),
	Weight( "None" ),
	Link to original data table( 0 )
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 Dec 2020 21:17:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-we-filter-data-based-on-time-and-take-the-average-using/m-p/342871#M59200</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-12-17T21:17:49Z</dc:date>
    </item>
    <item>
      <title>Re: How do we filter data based on time and take the average using JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-we-filter-data-based-on-time-and-take-the-average-using/m-p/343337#M59254</link>
      <description>&lt;P&gt;Is it possible to give some meaningful names to each section instead of 1, 2 and 3. For example can we name it as interval_1, interval_2 etc.&lt;BR /&gt;I tried this but the code doesn't run when I try it&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 20 Dec 2020 11:32:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-we-filter-data-based-on-time-and-take-the-average-using/m-p/343337#M59254</guid>
      <dc:creator>jojmp</dc:creator>
      <dc:date>2020-12-20T11:32:46Z</dc:date>
    </item>
    <item>
      <title>Re: How do we filter data based on time and take the average using JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-we-filter-data-based-on-time-and-take-the-average-using/m-p/343338#M59255</link>
      <description>&lt;P&gt;In the example I provided, the Section column was created as a Numeric column.&amp;nbsp; The values for numeric columns have to be valid numbers.&amp;nbsp; However, it is a simple matter to make the column a Character column and then the values of Section can be anything you want.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
dt=current data table();
dt &amp;lt;&amp;lt; new column("Section",
	ordinal,character,
	formula(
		If( 0 &amp;lt;= :TimeStamp &amp;lt;= 30,
			"Interval_1",
			50 &amp;lt;= :TimeStamp &amp;lt;= 80,
			"Interval_2",
			100 &amp;lt;= :TimeStamp &amp;lt;= 130,
			"Interval_3"
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I strongly suggest that you take the time to read the Discovering JMP and Using JMP documents from the JMP Documentation Library available under the Help pull down menu&lt;/P&gt;</description>
      <pubDate>Sun, 20 Dec 2020 12:01:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-we-filter-data-based-on-time-and-take-the-average-using/m-p/343338#M59255</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-12-20T12:01:29Z</dc:date>
    </item>
    <item>
      <title>Re: How do we filter data based on time and take the average using JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-we-filter-data-based-on-time-and-take-the-average-using/m-p/343340#M59257</link>
      <description>Thanks a lot for guiding me to the right resources, I will definitely read the documentation.</description>
      <pubDate>Sun, 20 Dec 2020 12:45:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-we-filter-data-based-on-time-and-take-the-average-using/m-p/343340#M59257</guid>
      <dc:creator>jojmp</dc:creator>
      <dc:date>2020-12-20T12:45:12Z</dc:date>
    </item>
  </channel>
</rss>

