I am unable to figure out how can i write or condition inside which in R. This statemnet does not work.
which(value>100 | value<=200)
I know it very basic thing but i am unable to find the right solution.
Thanks
I am unable to figure out how can i write or condition inside which in R. This statemnet does not work.
which(value>100 | value<=200)
I know it very basic thing but i am unable to find the right solution.
Thanks
does work. Remember to fully qualify the names of the variables you are selecting, as
iris$Species
in the example at hand (and not onlySpecies
).Have a look at the documentation here.
Also notice that whatever you do with
which
can be generally done otherwise in a faster and better way.Every value is either larger than 100 or smaller-or-equal to 200. Maybe you need other numbers or
&
instead of|
? Otherwise, there is no problem with that statement, the syntax is correct: