Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • Depends do you want to remove it by value e.g. "the value 5", or by index/indices "the element at index 5" or "at indices c(5:6,10)? If you want to remove by value and there are duplicates, then do you want to remove only the duplicates, first or last occurrence, or all? Is it guaranteed that the list contains your element/index? Do we need to handle the case where the list is empty? Do we need to ensure NA is passed (/excluded)? Is the list guaranteed to be flat or can it be nested? How many laters deep? Commented Aug 23, 2018 at 0:37
  • 5
    setdiff(myList,elementToRemove) Commented Sep 19, 2018 at 13:48