cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
%3CLINGO-SUB%20id%3D%22lingo-sub-342845%22%20slang%3D%22en-US%22%20mode%3D%22UPDATE%22%3EComment%20filtrer%20les%20donn%C3%A9es%20en%20fonction%20du%20temps%20et%20prendre%20la%20moyenne%20%C3%A0%20l'aide%20de%20JSL%26nbsp%3B%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-342845%22%20slang%3D%22en-US%22%20mode%3D%22UPDATE%22%3E%3CP%3EJ'ai%20des%20donn%C3%A9es%20captur%C3%A9es%20pendant%20une%20dur%C3%A9e%20particuli%C3%A8re.%20Veuillez%20trouver%20ci-dessous%20un%20instantan%C3%A9%20du%20tableau%20(ci-joint)%26nbsp%3B%3A%3C%2FP%3E%3CTABLE%3E%3CTBODY%3E%3CTR%3E%3CTD%3E%3CSTRONG%3EHorodatage%3C%2FSTRONG%3E%3C%2FTD%3E%3CTD%3E%3CSTRONG%3EA%3C%2FSTRONG%3E%3C%2FTD%3E%3CTD%3E%3CSTRONG%3EB%3C%2FSTRONG%3E%3C%2FTD%3E%3CTD%3E%3CSTRONG%3EC%3C%2FSTRONG%3E%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E0%2C001%3C%2FTD%3E%3CTD%3E10.005%3C%2FTD%3E%3CTD%3E450.4451%3C%2FTD%3E%3CTD%3E428.9093%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E0%2C002%3C%2FTD%3E%3CTD%3E10.01%3C%2FTD%3E%3CTD%3E450.8904%3C%2FTD%3E%3CTD%3E429.0295%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E0%2C003%3C%2FTD%3E%3CTD%3E10.015%3C%2FTD%3E%3CTD%3E451.336%3C%2FTD%3E%3CTD%3E429.0177%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E0%2C004%3C%2FTD%3E%3CTD%3E10.02%3C%2FTD%3E%3CTD%3E451.7818%3C%2FTD%3E%3CTD%3E428.9279%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E0%2C005%3C%2FTD%3E%3CTD%3E10.025%3C%2FTD%3E%3CTD%3E452.2278%3C%2FTD%3E%3CTD%3E428.8491%3C%2FTD%3E%3C%2FTR%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3CP%3E%20%3C%2FP%3E%3CP%3ELe%20trac%C3%A9%20de%20la%20colonne%20C%20ressemble%20%C3%A0%20ci-dessous%26nbsp%3B%3A%3CBR%20%2F%3E%20%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22time_avg.jpg%22%20style%3D%22width%3A%20695px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22time_avg.jpg%22%20style%3D%22width%3A%20695px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F29022i12170E3B274174C4%2Fimage-dimensions%2F695x358%3Fv%3Dv2%22%20width%3D%22695%22%20height%3D%22358%22%20role%3D%22button%22%20title%3D%22time_avg.jpg%22%20alt%3D%22time_avg.jpg%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EJe%20dois%20filtrer%20les%20lignes%20des%20sections1%2C%202%20et%203%20et%20trouver%20leur%20moyenne.%3C%2FP%3E%3CP%3EChaque%20section%20dure%2030%20secondes%2C%20calcul%C3%A9e%20%C3%A0%20partir%20de%20la%20colonne%20d'horodatage%20et%20il%20y%20a%20un%20intervalle%20de%2020%20secondes%20entre%20chaque%20section.%3CBR%20%2F%3E%20Le%20tableau%20des%20r%C3%A9sultats%20finaux%20devrait%20%C3%AAtre%20le%20suivant%26nbsp%3B%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CTABLE%20border%3D%220%22%20cellspacing%3D%220%22%20cellpadding%3D%220%22%3E%3CTBODY%3E%3CTR%3E%3CTD%3ESection%3C%2FTD%3E%3CTD%3Emoyenne(A)%3C%2FTD%3E%3CTD%3Emoyenne(B)%3C%2FTD%3E%3CTD%3Emoyenne(C)%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E1%3C%2FTD%3E%3CTD%3E10.005%3C%2FTD%3E%3CTD%3E450.4451%3C%2FTD%3E%3CTD%3E428.9093%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E2%3C%2FTD%3E%3CTD%3E10.01%3C%2FTD%3E%3CTD%3E450.8904%3C%2FTD%3E%3CTD%3E429.0295%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E3%3C%2FTD%3E%3CTD%3E10.015%3C%2FTD%3E%3CTD%3E451.336%3C%2FTD%3E%3CTD%3E429.0177%3C%2FTD%3E%3C%2FTR%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3CP%3E%3CBR%20%2F%3EPourriez-vous%20s'il%20vous%20pla%C3%AEt%20nous%20indiquer%20comment%20filtrer%20les%20lignes%20des%20sections%201%2C%202%20et%203%20et%20trouver%20leur%20moyenne%20%C3%A0%20l'aide%20d'un%20script.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-342845%22%20slang%3D%22en-US%22%20mode%3D%22UPDATE%22%3E%3CLINGO-LABEL%3EIng%C3%A9nierie%20Qualit%C3%A9%20et%20Proc%C3%A9d%C3%A9s%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-343340%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%26nbsp%3B%3A%20Comment%20filtrer%20les%20donn%C3%A9es%20en%20fonction%20du%20temps%20et%20prendre%20la%20moyenne%20%C3%A0%20l'aide%20de%20JSL%26nbsp%3B%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-343340%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EMerci%20beaucoup%20de%20m'avoir%20guid%C3%A9%20vers%20les%20bonnes%20ressources%2C%20je%20vais%20certainement%20lire%20la%20documentation.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-343338%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%26nbsp%3B%3A%20Comment%20filtrer%20les%20donn%C3%A9es%20en%20fonction%20du%20temps%20et%20prendre%20la%20moyenne%20%C3%A0%20l'aide%20de%20JSL%26nbsp%3B%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-343338%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EDans%20l'exemple%20que%20j'ai%20fourni%2C%20la%20colonne%20Section%20a%20%C3%A9t%C3%A9%20cr%C3%A9%C3%A9e%20en%20tant%20que%20colonne%20num%C3%A9rique.Les%20valeurs%20des%20colonnes%20num%C3%A9riques%20doivent%20%C3%AAtre%20des%20nombres%20valides.Cependant%2C%20il%20est%20simple%20de%20faire%20de%20la%20colonne%20une%20colonne%20de%20caract%C3%A8res%2C%20puis%20les%20valeurs%20de%20Section%20peuvent%20%C3%AAtre%20tout%20ce%20que%20vous%20voulez.%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Enames%20default%20to%20here(1)%3B%0Adt%3Dcurrent%20data%20table()%3B%0Adt%20%26lt%3B%26lt%3B%20new%20column(%22Section%22%2C%0A%20ordinal%2Ccharacter%2C%0A%20formula(%0A%20%20If(%200%20%26lt%3B%3D%20%3ATimeStamp%20%26lt%3B%3D%2030%2C%0A%20%20%20%22Interval_1%22%2C%0A%20%20%2050%20%26lt%3B%3D%20%3ATimeStamp%20%26lt%3B%3D%2080%2C%0A%20%20%20%22Interval_2%22%2C%0A%20%20%20100%20%26lt%3B%3D%20%3ATimeStamp%20%26lt%3B%3D%20130%2C%0A%20%20%20%22Interval_3%22%0A%20%20)%0A%20)%0A)%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EJe%20vous%20sugg%C3%A8re%20fortement%20de%20prendre%20le%20temps%20de%20lire%20les%20documents%20D%C3%A9couvrir%20JMP%20et%20Utiliser%20JMP%20de%20la%20biblioth%C3%A8que%20de%20documentation%20JMP%20disponible%20dans%20le%20menu%20d%C3%A9roulant%20Aide%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-343337%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%26nbsp%3B%3A%20Comment%20filtrer%20les%20donn%C3%A9es%20en%20fonction%20du%20temps%20et%20prendre%20la%20moyenne%20%C3%A0%20l'aide%20de%20JSL%26nbsp%3B%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-343337%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EEst-il%20possible%20de%20donner%20des%20noms%20significatifs%20%C3%A0%20chaque%20section%20au%20lieu%20de%201%2C%202%20et%203.%20Par%20exemple%2C%20pouvons-nous%20le%20nommer%20comme%20interval_1%2C%20interval_2%20etc.%3CBR%20%2F%3E%20J'ai%20essay%C3%A9%20ceci%20mais%20le%20code%20ne%20s'ex%C3%A9cute%20pas%20lorsque%20je%20l'essaie%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-342871%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%26nbsp%3B%3A%20Comment%20filtrer%20les%20donn%C3%A9es%20en%20fonction%20du%20temps%20et%20prendre%20la%20moyenne%20%C3%A0%20l'aide%20de%20JSL%26nbsp%3B%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-342871%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EVoici%20comment%20je%20proc%C3%A9derais.Il%20ne%20correspond%20pas%20%C3%A0%20vos%20r%C3%A9sultats%2C%20mais%20il%20suit%20les%20instructions%20que%20vous%20avez%20indiqu%C3%A9es%2C%20en%20calculant%20la%20section%20en%20fonction%20des%20valeurs%20TimeStamp%20de%200-30%20%3D%20Section%201%2C%2050-80%20%3D%20Section%202%2C%20100-130%20%3D%20Section%203%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22section.PNG%22%20style%3D%22width%3A%20603px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22section.PNG%22%20style%3D%22width%3A%20603px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22section.PNG%22%20style%3D%22width%3A%20603px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22section.PNG%22%20style%3D%22width%3A%20603px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F29024iB0CC2D14B7FC3FFF%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22section.PNG%22%20alt%3D%22section.PNG%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Enames%20default%20to%20here(1)%3B%0Adt%3Dcurrent%20data%20table()%3B%0Adt%20%26lt%3B%26lt%3B%20new%20column(%22Section%22%2C%0A%20ordinal%2C%0A%20formula(%0A%20%20If(%200%20%26lt%3B%3D%20%3ATimeStamp%20%26lt%3B%3D%2030%2C%0A%20%20%201%2C%0A%20%20%2050%20%26lt%3B%3D%20%3ATimeStamp%20%26lt%3B%3D%2080%2C%0A%20%20%202%2C%0A%20%20%20100%20%26lt%3B%3D%20%3ATimeStamp%20%26lt%3B%3D%20130%2C%0A%20%20%203%0A%20%20)%0A%20)%0A)%3B%0A%0Adt%20%26lt%3B%26lt%3B%20Summary(%0A%20Group(%20%3ASection%20)%2C%0A%20Mean(%20%3AA%20)%2C%0A%20Mean(%20%3AB%20)%2C%0A%20Mean(%20%3AC%20)%2C%0A%20Freq(%20%22None%22%20)%2C%0A%20Weight(%20%22None%22%20)%2C%0A%20Link%20to%20original%20data%20table(%200%20)%0A)%3B%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar
jojmp
Level III

How do we filter data based on time and take the average using JSL?

I have data captured for a particular duration of time. Please find below snapshot of the table (attached the same):

TimeStampABC
0.00110.005450.4451428.9093
0.00210.01450.8904429.0295
0.00310.015451.336429.0177
0.00410.02451.7818428.9279
0.00510.025452.2278428.8491

 

The plot of column C looks like below:
time_avg.jpg

I need to filter the rows in section1 , 2 & 3 and find their average.

Each section spans for 30second duration which is calculated from timestamp column  and there is a 20 second interval between each section.
The final result table should be as below:

Sectionmean(A)mean(B)mean(C)
110.005450.4451428.9093
210.01450.8904429.0295
310.015451.336429.0177


Could you please advise how can we filter the rows in section1 , 2 & 3 and find their average using script.

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How do we filter data based on time and take the average using JSL?

Here is how I would do it.  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

section.PNG

names default to here(1);
dt=current data table();
dt << new column("Section",
	ordinal,
	formula(
		If( 0 <= :TimeStamp <= 30,
			1,
			50 <= :TimeStamp <= 80,
			2,
			100 <= :TimeStamp <= 130,
			3
		)
	)
);

dt << Summary(
	Group( :Section ),
	Mean( :A ),
	Mean( :B ),
	Mean( :C ),
	Freq( "None" ),
	Weight( "None" ),
	Link to original data table( 0 )
);
Jim

View solution in original post

4 REPLIES 4
txnelson
Super User

Re: How do we filter data based on time and take the average using JSL?

Here is how I would do it.  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

section.PNG

names default to here(1);
dt=current data table();
dt << new column("Section",
	ordinal,
	formula(
		If( 0 <= :TimeStamp <= 30,
			1,
			50 <= :TimeStamp <= 80,
			2,
			100 <= :TimeStamp <= 130,
			3
		)
	)
);

dt << Summary(
	Group( :Section ),
	Mean( :A ),
	Mean( :B ),
	Mean( :C ),
	Freq( "None" ),
	Weight( "None" ),
	Link to original data table( 0 )
);
Jim
jojmp
Level III

Re: How do we filter data based on time and take the average using JSL?

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.
I tried this but the code doesn't run when I try it 

txnelson
Super User

Re: How do we filter data based on time and take the average using JSL?

In the example I provided, the Section column was created as a Numeric column.  The values for numeric columns have to be valid numbers.  However, it is a simple matter to make the column a Character column and then the values of Section can be anything you want.

names default to here(1);
dt=current data table();
dt << new column("Section",
	ordinal,character,
	formula(
		If( 0 <= :TimeStamp <= 30,
			"Interval_1",
			50 <= :TimeStamp <= 80,
			"Interval_2",
			100 <= :TimeStamp <= 130,
			"Interval_3"
		)
	)
);

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

Jim
jojmp
Level III

Re: How do we filter data based on time and take the average using JSL?

Thanks a lot for guiding me to the right resources, I will definitely read the documentation.