[R] x[x > y] and more conditions

Uwe Ligges ligges at statistik.uni-dortmund.de
Tue Nov 18 11:28:52 CET 2003



On Tue, 18 Nov 2003, Christian Schulz wrote:

> ...and  i'm getting all cases which
> are true for above condition and get the information
> how many cases match, too. The vector's are in a attached data.frame.
> 
> FAKTOR30[FAKTOR30 > 0.234]
> ...................
> [102193] 0.352 0.352 0.288 0.354 0.352 0.358 0.352 0.352 0.311 0.370 0.352
> 0.336
> [102205] 0.352 0.274 0.352 0.405 0.354 0.352 0.352 0.352 0.352 0.352 0.352
> 0.340
> [102217] 0.352 0.352
> 
> 
> But if i use more than one "index" term
> UMSATZ30[UMSATZ30 > 10] && FAKTOR30[FAKTOR30 = 0.234]
> 
> [1] NA

See ?"&&" which tells you to use "&" instead os "&&" for vectorized
logical operations like this one.

Using "&&" only evaluates the first elements of those logical vectors, so
there seems to be an NA in UMSATZ30[1] or FAKTOR30[1]....

Uwe Ligges

 
> I get  true, false  or NA  and the latter i think this mean there isn't any
> case with this condition!?
> But, how can i check cases with more than one condition like the single
> example, i trial some but getting no success?
> 
> Many thanks for help,
> christian
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>




More information about the R-help mailing list