home *** CD-ROM | disk | FTP | other *** search
-
- _L_o_g_i_c_a_l _O_p_e_r_a_t_o_r_s
-
- x & y
- x && y
- x | y
- x || y
- ! x
-
- _D_e_s_c_r_i_p_t_i_o_n:
-
- These operators act on logical vectors. & and && indi-
- cate 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 ele-
- ment of each vector. Evaluation proceeds only until
- the result is determined. The longer form is appropri-
- ate for programming control-flow.
-
- ! indicates logical negation (NOT).
-
- _E_x_a_m_p_l_e_s:
-
- y <- 1 + (x <- rpois(50, lambda=1.5)/4 - 1)
- x[(x > 0) & (x < 1)] # all x values between 0 and 1
- if(any(x==0) || any(y==0)) "zero encountered"
-
-