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

From: Josh Roofchop <josh_at_roofchop.com>
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: http://www.nabble.com/Remove-a-number-from-a-vector-tp16119616p16121649.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
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 https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive