Hi,
I am using JMP10. I am trying to create a script to delete duplicate rows of data in a data table. An example of my attempt is as follows:
// Start.
// Create data table.
dt = open("$SAMPLE_DATA/Big Class.jmp");
dt << Select Randomly(5);
subdt = dt << Subset(Output Table Name("subset"), Invisible);
dt << Concatenate(subdt, Append to First Table);
Close(subdt, No Save);
dt << Clear Select;
// Find and delete duplicate rows for bigClass.
icol = dt << New Column( "Index", Numeric, Continuous, Formula( Sequence( 1, N Row( dt ), 1, 1 ) ) );
repcol = dt << New Column( "Repeat Data",
Numeric,
Continuous,
Formula( If( :Index == Col Minimum( :Index, :name, :age, :sex, :height, :weight ), 1, 0 ) )
);
dt << Select Where( As Column(repcol) == 0 );
dt << Delete Rows();
dt << Delete Columns( {icol, repcol} );
// Find and delete duplicate rows for generic data table.
colnames = dt << Get Column Names();
icol = dt << New Column( "Index", Numeric, Continuous, Formula( Sequence( 1, N Row( dt ), 1, 1 ) ) );
repcol = dt << New Column( "Repeat Data",
Numeric,
Continuous,
Formula( If( :Index == Col Minimum( :Index, /* Insert colnames here. */ ), 1, 0 ) )
);
dt << Select Where( As Column(repcol) == 0 );
dt << Delete Rows();
dt << Delete Columns( {icol, repcol} );
// End.
My problem is I would like to make this script run on a generic data table. How can I insert my colnames list into my formula? Is there a more clever way to do this?
Thanks!