Re: [R] Re move a number from a vector

From: Josh Roofchop <>
Date: Tue, 18 Mar 2008 06:55:20 -0700 (PDT)

Thanks to both John and Arthur for their replies, they both worked great. Josh

Josh Roofchop wrote:
> This should be an easy one, but I haven't been able to figure it out,
> x<-c(2, 4, 6, 9, 10)
> #how do I remove a single value
> x<-x[-2] # will remove the second element of the vector not the number 2
> This is part of a loop that looks a little like this...
> x<-c(2, 4, 6, 9, 10)
> remove.value<-4
> #then I need to remove the value returned by the loop.
> Thanks,
> Josh

View this message in context:
Sent from the R help mailing list archive at

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Tue 18 Mar 2008 - 14:42:55 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 18 Mar 2008 - 15:30:21 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive