I met a problem when writting my JMP script, I want to add the new column with a formula Y/X but there are serveal colunms and I want to add the new colunm after specified column,
For example:
A Table like:
A B C D
1 2 3 4
2 4 6 8
and I want to add a new column after B column(like below), but the B/A column will always after D when I use New Column function, and I cannot find a good function from the scripting index , how to insert a column to a specified column index?
<
A B B/A C D
1 2 2 3 4
2 4 2 6 8
Use the
<< Move Selected Columns()
message to move the new column to where you want it
Names Default To Here( 1 );
// Open Data Table: big class.jmp
// → Data Table( "big class" )
dt = Open( "$SAMPLE_DATA/big class.jmp" );
// New column: Column 6
dt << New Column( "Column 6",
Numeric,
"Continuous",
Format( "Best", 12 )
) << Move Selected Columns( {:Column 6}, after( :sex ) );
or
Names Default To Here( 1 );
// Open Data Table: big class.jmp
// → Data Table( "big class" )
dt = Open( "$SAMPLE_DATA/big class.jmp" );
// New column: Column 6
dt << New Column( "Column 6",
Numeric,
"Continuous",
Format( "Best", 12 )
);
dt << Move Selected Columns( {:Column 6}, after( :sex ) );