On Aug 27, 2011, at 5:31 AM, 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]

I am not completely clear but it appears that you want to remove the first and last elements. You can use negative indexing vectors.

x[ -c(1, length(x) ) ]



However, I am fail

Perhaps your vector is a factor? Try this and see what you get:

str(x)


since same results are give even try it for many times.I
also try with shorter vector with 10 element. It is successfully resulted. So,want can I do for it. Kindly asking favor for expert here. Thank you very
much.

Chuan

--


David Winsemius, MD
West Hartford, CT

______________________________________________
R-help@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.

Reply via email to