[R] Re move a number from a vector

From: Josh Roofchop <josh_at_roofchop.com>
Date: Tue, 18 Mar 2008 05:21:08 -0700 (PDT)

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)
#then I need to remove the value returned by the loop.


View this message in context: http://www.nabble.com/Remove-a-number-from-a-vector-tp16119616p16119616.html
Sent from the R help mailing list archive at Nabble.com.

R-help_at_r-project.org mailing list
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 - 13:00:27 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