I have a list and I want to remove a single element from it. How can I do this?
I\'ve tried looking up what I think the obvious names for this function would be in
I would like to add that if it's a named list you can simply use within.
within
l <- list(a = 1, b = 2) > within(l, rm(a)) $b [1] 2
So you can overwrite the original list
l <- within(l, rm(a))
to remove element named a from list l.
a
l