anne wrote:

Hello

This is a very newbie question on R syntax, but I do not find the answer....

I want to make a selection on an interval say choose Xint in the interval of temperatures 390-399

I tried this syntax
Xint<- X[t>=390 && t< 400] typing >XintI get the answer numeric(0)

it did not select any object! 'though I verified that there indeed are occrencies of X in this interval


Any idea?


thanks

Anne

The idea is to read help("&&"). It tells you:


"& and && indicate logical AND and | and || indicate logical OR. The shorter form performs elementwise comparisons in much the same way as arithmetic operators. The longer form evaluates left to right examining only the first element of each vector. Evaluation proceeds only until the result is determined. The longer form is appropriate for programming control-flow and typically preferred in if clauses."

So I guess you want
 Xint <- X[(t >= 390) & (t < 400)]

Uwe Ligges

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to