Skip to content
Prev 157138 / 398506 Next

Exclusion of elements in a vector

Try this:

vector[ setdiff(seq_along(vector), as.numeric(idx)) ]

where idx is your vector of indices to exclude, e.g.
idx <- 3:4
idx <- numeric(0)
idx <- NULL

The last one gets converted to numeric(0) by
as.numeric so it still works.

On Thu, Sep 25, 2008 at 7:43 AM, Stefan Fritsch
<fritsch at bips.uni-bremen.de> wrote: