cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Instantly extract effect sizes, F-ratios, and FDR-adjusted p-values from your models with the Calculate Effects Sizes extension, available now in the JMP Marketplace!
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • Your voice matters! Tell us how you prefer to receive JMP updates, so we can tailor our communication to your needs. Take short survey.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
Neo
Neo
Level VI

How to remove duplicate entries from a list?

If I have a list like

myList  = {"John", "Dan", "Rob", "Rob", "Matt", "Shane", "Matt", "Shane", "John"};

How do I get a list with duplicate entries removed ?

myList_new= {"John", "Dan", "Rob", "Matt", "Shane"};

 

When it's too good to be true, it's neither
1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: How to remove duplicate entries from a list?

If it doesn't matter that order changes you can use associative array

Names Default To Here(1);

myList  = {"John", "Dan", "Rob", "Rob", "Matt", "Shane", "Matt", "Shane", "John"};
my_list = Associative Array(myList) << get keys;
-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User

Re: How to remove duplicate entries from a list?

If it doesn't matter that order changes you can use associative array

Names Default To Here(1);

myList  = {"John", "Dan", "Rob", "Rob", "Matt", "Shane", "Matt", "Shane", "John"};
my_list = Associative Array(myList) << get keys;
-Jarmo
hogi
Level XIII

Re: How to remove duplicate entries from a list?

Unfortunately, Associative Arrays get slow if the list is long.

 

There are other approaches like Summarize and Tables/Summary which are way faster.

So, sometimes it could make sense to create a data table, fill a new column with the list values and use the fast table functions.

 

Best:
go to Provide fast way to get unique values from JMP objects (column, lists), possibly similar to Python's...  and support @jthi 's wish with a Kudo :)

 

Recommended Articles