Linked Questions
20 questions linked to/from How to delete elements from list1 appearing in list2?
4 votes
1 answer
412 views
Delete all French stopwords [duplicate]
I have a list of french stopwords: ...
2 votes
0 answers
798 views
Subtract Elements of two Lists [duplicate]
I have two Lists: L = {1,2,3,4,5} and K = {1,4}. I would like to delete the elements of K (...
1 vote
4 answers
242 views
Seek a quick way to bring standard order back to original after Complement [duplicate]
the Complement gives result in standard order. But that's not what I want. I want it to keep the original order. say I have a list ...
1 vote
1 answer
381 views
What is the fastest way to delete multiple entries from a list? [duplicate]
Mathematica allows Deleting multiple objects from a list given their position. However, if I don't know their positions (finding their positions in the list is too costly if the list is long), how can ...
1 vote
0 answers
156 views
Removing every member of a list from another list [duplicate]
I have a list of lists A={{1,2},{3,6},{7,8},{5,0}}, and another list of lists B={{1,2},{5,0}}. If any list in B is also in A, I want to remove them from A. E.g.,Taking {1,2} and {5,0} out of A to get ...
3 votes
1 answer
102 views
Removing elements from nested list [duplicate]
I would like to remove the element of A1 from the list B1: How I can do that? Thank you! A1= {{5, 6}, {4, 5}, {5, 4}} ...
39 votes
11 answers
7k views
Removing elements from a list which appear in another list
There are two lists {a, b, c, a, d, a, e} and {a, c, a}. I need to remove those elements from the first list which appears in a second list, to get {b, d, a, e}
24 votes
13 answers
2k views
How do I obtain an intersection of two or more list of lists conditioned on the first element of each sub-list?
Given two lists like list1 = {{1, 1}, {2, 4}, {3, 9}, {4, 16}}; list2 = {{2, 6}, {3, 9}, {4, 12}, {5, 15}}; I would like to produce an output like ...
23 votes
10 answers
2k views
How do I delete all items that occur more than once?
DeleteDuplicates works fine but leaves a single copy of the duplicated item. I need to remove all items that occur more than once i.e. {{1,2},{1,2},{3,4}} -> ...
13 votes
8 answers
1k views
Counting the population of integers
Suppose that myData is a list of sublists. Each sublist has a length of one or greater and contains any number of replicates of the integers 1, 2, 3, and 4. I ...
12 votes
7 answers
891 views
How to use Intersection[] but keep the original list order?
I want to keep the original order of l1: ...
8 votes
5 answers
997 views
Complement[] changes order of elements?
Consider this example: Complement[{a, y, c, d, e}, {a, c}, {d}] (*{e, y}*) However, I was expecting the result to be: ...
5 votes
4 answers
1k views
Removing certain numbers from a list
If I have a list of numbers {1, 2, 4, 70, 11, 20, 56, 79}, is there a way to remove the list {2, 4, 56} from that list? In my ...
11 votes
2 answers
740 views
Complement on pre-sorted lists
Is there any way to instruct Complement to skip the sorting part? If the answer is no (likely), the next question would be: how can I remove from a sorted list ...
3 votes
3 answers
275 views
Dropping list elements that are members of other lists [closed]
I have a set: $$A=\{\{1,2,3\},\{1,3,2\},\{2,1,3\},\{2,3,1\},\{3,1,2\},\{3,2,1\}\}$$ I want to drop elements found in sets B and C from A. $$B=\{\{1,3,2\},\{2,1,3\}\}$$ $$C=\{\{3,1,2\},\{3,2,1\}\}$$ ...