Message-ID: <4E5B643F.2020600@bitwrit.com.au>
Date: 2011-08-29T10:04:47Z
From: Jim Lemon
Subject: Asking Favor For "Remove element with Particular Value In Vector"
In-Reply-To: <FD557373-BF56-45B0-AAD5-70BF5A0B1E00@comcast.net>
chuan_zl wrote:
> Dear All.
>
> I am Chuan. I am beginner for R.I facing some problem in remove
element from
> vector.I have a vector with size 238 element as follow(a part)
>
> [1] 0 18 24 33 44..................................[238] 255
>
> Let the vector label as "x",I want remove element "0" and "255".I try use
> such function:
>
> x[x>0 & x<255]
Hi Chuan,
If you want to remove the specific values 0 and 255 from your vector, try:
x<-x[-which(x %in% c(0,255))]
Jim