Re: [R] removal of an element from a vector

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Thu 05 Jan 2006 - 01:23:35 EST

idx <- x < 100
x[idx]
x[!idx]

On 1/4/06, gynmeerut <gynmeerut@indiatimes.com> wrote:
>
> Dear All,
> I have some problem in R which I'm explaining using an example:
> x<-(120,235,172,95,175,200,233,142)
> i want to remove the elements which are lesser than 100 and as a result i want two vectors
>
> y<-(containing elements <100)
> z<-(remaining elements)
>
>
> Moreover if I wish to use two different programs for vectors y and z.
> which command shall I use(will IF-ELSE work ?)
>
>
>
> Thanks and regards,
>
> GS
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Jan 05 01:41:50 2006

This archive was generated by hypermail 2.1.8 : Thu 05 Jan 2006 - 05:28:40 EST