Skip to content
Back to formatted view

Raw Message

Message-ID: <1205845528.6332.53.camel@localhost>
Date: 2008-03-18T13:05:28Z
From: Albert Greinoecker
Subject: Re move a number from a vector
In-Reply-To: <16119616.post@talk.nabble.com>

does 
> x[!x == remove.value]
do what you need?

[1]  2  6  9 10

regards,
Albert

Am Dienstag, den 18.03.2008, 05:21 -0700 schrieb Josh Roofchop:
> 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
>