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