cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
Arocha1
Level I

Deleting Multiple Replicate Rows (n=5 or more)

I have a table where column 1 has titles, and column 2 has values. I need a script that can find any title in column 1 that appears more that 5 times and deletes the entire row. If it it equal to or less than 5, it can stay. The closest thing I could come to was deleting duplicates, but I want to keep duplicates and delete only anything over a "quintuplet".

 

JMP 16

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Deleting Multiple Replicate Rows (n=5 or more)

You could create summary table and then check from the if N Rows >= 5 and using summary table to select correct rows from main table and then delete those rows from main table. Same could also be done by using Summarize, Tabulate, Col formula column and many other methods.

Here is example using calculation column

Names Default To Here(1);

dt = New Table("Untitled",
	Add Rows(6),
	New Column("Column 1", Character, "Nominal", Set Values({"a", "a", "a", "b", "b", "c"}))
);

wait(1);
dt << New Column("Count", Numeric, Continuous, << Set Each Value(
	Col Number(1, :Column 1)
));

wait(1);
dt << Select Where(:Count >= 3) << Delete Rows;
-Jarmo

View solution in original post

1 REPLY 1
jthi
Super User

Re: Deleting Multiple Replicate Rows (n=5 or more)

You could create summary table and then check from the if N Rows >= 5 and using summary table to select correct rows from main table and then delete those rows from main table. Same could also be done by using Summarize, Tabulate, Col formula column and many other methods.

Here is example using calculation column

Names Default To Here(1);

dt = New Table("Untitled",
	Add Rows(6),
	New Column("Column 1", Character, "Nominal", Set Values({"a", "a", "a", "b", "b", "c"}))
);

wait(1);
dt << New Column("Count", Numeric, Continuous, << Set Each Value(
	Col Number(1, :Column 1)
));

wait(1);
dt << Select Where(:Count >= 3) << Delete Rows;
-Jarmo