Delete Duplicate rowsHi,
I have a datable that I want to delete rows on a duplicate value in a col.
Thank you,
Rami
Re: Delete Duplicate rowsThanks Bill for the tip/trick.
I sometimes have duplicate rows but struggle how to delete them. Just thinking about JMP Community and it helps to solve the issue.
Re: Delete Duplicate rowsThe Select Duplicate Rows() function was not in JMP 12. The below code should do what you want
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\Big Class.JMP" );
dt << sort( by( :Part_number ), order( ascending ), Replace Table( 1 ) );
dt << New Column( "dup",
formula(
If(
Row() == 1, value = 1,
:Part_number != Lag( :Part_number ), value = 1,
value
++);
value;
)
);
dt << select where( :dup > 1);
dt << delete rows;
dt << delete column( "dup" );
Re: Delete Duplicate rowsI have a data table which has column called Part_number.I need to remove duplicate part_numbers.The delete duplicate rows options suggested above deosnt work as in no rows get selected.The column is character,nominal type.I'm using JMP12.
Any other options that I can try?
Also does this function retain the first row and delete the repititions as in Excel?
Thanks
Re: Delete Duplicate rowsIt is recommended that JMP continue to improve to enable all automation with JSL.Thank you very much!
Re: Delete Duplicate rowsHi Rami,
Jim's script is a nice option, but if you have JMP 14 you can also select duplicate rows in a column by point and click.
Highlight the column of interest, go to the Rows dropdown or red hot spot. Rows > Row Selection > Select Duplicate Rows. All of the duplicate values will be highlighted in by row number. Right click anywhere in the blue region and select delete.
HTH
Bill
Re: Delete Duplicate rowsSelect Duplicat Rows() function will highlight rows for a specified column(s)
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt <<
Select duplicate rows( Match( :name ) );
xx=dt<<GET selected="" rows="">0,
dt<<DELETE rows=""></DELETE></GET>