cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Image to Table JMP extension imports single or batch images as data tables. Useful to extract curves from pictures or convert image data to curve data to use in analyses like Functional Data Explorer. Download and install the extension.

Discussions

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

batch table transformation: generate vector columns

What is the fastest way to generate Vector Columns from a tall table in JMP?


Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class Families.jmp" );


// Data table summary
// → Data Table( "Summary of Big Class Families grouped by age etc." )
tmp = dt << Summary( Group( :age, :sex, :height, :weight ) );


// New formula columns
tmp << New Column( "Rank", Formula( Col Rank( 1, :age, :sex ) ) );

// Split data table
// → Data Table(
//   	"Split of Summary of Big Class Families grouped by age etc. by Rank[age]"
//   )
final = tmp << Split( Split By( :Rank ), Split( :height, :weight ), Group( :age, :sex ) );

final << New Column( "heights",
	Expression,
	set each value(
		Matrix( {:height 1, :height 2, :height 3, :height 4, :height 5, :height 6} )
	)
);

final << New Column( "weights",
	Expression,
	set each value(
		Matrix( {:weight 1, :weight 2, :weight 3, :weight 4, :weight 5, :weight 6} )
	)
);

final << Delete Columns({:height 1, :height 2, :height 3, :height 4, :height 5, :height 6,:weight 1, :weight 2, :weight 3, :weight 4, :weight 5, :weight 6})

NB: I don't need the missing entries.

1 REPLY 1
jthi
Super User

Re: batch table transformation: generate vector columns

My initial guess would be some sort of loop to get matching rows for each of the rows and using data table subscripting to get/set the values.

-Jarmo

Recommended Articles