[R] Understanding which

Ashim Kapoor @@himk@poor @ending from gm@il@com
Wed Apr 18 13:13:30 CEST 2018


Dear All,

Here is a reprex:

> x<- 1:100
> x[-which(x>100)]
integer(0)

In words, I am finding out which indices correspond to values in x which
are  greater than  100 ( there are no such items ) . Then I remove those
indices. I should get back the x that I started with since there are no
items in x which are bigger than 100 . Instead, it is returning an empty
vector.

Why is this ? What am I misunderstanding?

Best Regards,
Ashim

	[[alternative HTML version deleted]]




More information about the R-help mailing list