lower.tri                package:base                R Documentation

_L_o_w_e_r _a_n_d _U_p_p_e_r _T_r_i_a_n_g_u_l_a_r _P_a_r_t _o_f _a _M_a_t_r_i_x

_D_e_s_c_r_i_p_t_i_o_n:

     Returns a matrix of logicals the same size of a given matrix with
     entries `TRUE' in the lower or upper triangle.

_U_s_a_g_e:

     lower.tri(x, diag = FALSE)
     upper.tri(x, diag = FALSE)

_A_r_g_u_m_e_n_t_s:

       x: a matrix.

    diag: logical. Should the diagonal be included?

_S_e_e _A_l_s_o:

     `diag', `matrix'.

_E_x_a_m_p_l_e_s:

     m2 <- ma <- matrix(1:20, 4, 5)
     m2[lower.tri(m2)] <- NA
     m2
     stopifnot(lower.tri(ma) == !upper.tri(ma, diag=TRUE))

