cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • Use World Cup data to build models, explore spatial relationships, and create informative visualizations in JMP. Register. July 17, 2 pm US Eastern Time.
  • Your voice matters! Tell us how you prefer to receive JMP updates, so we can tailor our communication to your needs. Take short survey.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
Yu
Yu
Level II

create an array

i want to create a num array, but how could i do it? example: if i have a data table,i want to use mean value of the first two columns and  maximum of the last six columns to make an array, but i failed. 

a=mean(:column 1);
b=mean(:column 2);
c=max(:column 3);
d=max(:column 4);
e=max(:column 5);
f=max(:column 6);
g=max(:column 7);
h=max(:column 8);

array1=[a,b,c,d,e,f,g,h];

 the jsl file i written is  wrong, how could i correct it. thank you very much.

2 REPLIES 2
ian_jmp
Level X

Re: create an array

Here's one way :

NamesDefaultToHere(1);

// Make some data
dt = NewTable("Test",
		NewColumn("Col 1", Formula(RandomNormal())),
		NewColumn("Col 2", Formula(RandomNormal())),
		NewColumn("Col 3", Formula(RandomNormal())),
		NewColumn("Col 4", Formula(RandomNormal())),
		NewColumn("Col 5", Formula(RandomNormal())),
		NewColumn("Col 6", Formula(RandomNormal())),
		NewColumn("Col 7", Formula(RandomNormal())),
		NewColumn("Col 8", Formula(RandomNormal())),
		<< addRows(10)
		);
		
// Get the statistics into a column vector using data table subscripting
myStats = Matrix({
				Mean(dt[0, 1]),
				Mean(dt[0, 2]),
				Max(dt[0, 3]),
				Max(dt[0, 4]),
				Max(dt[0, 5]),
				Max(dt[0, 6]),
				Max(dt[0, 7]),
				Max(dt[0, 8])
				});
Print(Round(myStats, 3));
Yu
Yu
Level II

Re: create an array

thank you very much! It is an excellent solution!

Recommended Articles