title: Efficiently adding or removing elements to a vector or list in R?
body: <p>I'm implementing an algorithm that involves lots of adding and removing things from sets. In R, this is slow because as far as I know, adding or removing things from a vector is slow, since the entire vector has to be re-allocated. Is there a way do do it more efficiently?</p>
  
  <p>Edit: My current solution is to use a boolean vector of the same length as the list of things that can be in the set, and using that as a membership table.</p>