upperTriangle             package:gdata             R Documentation

_E_x_t_r_a_c_t _o_r _r_e_p_l_a_c_e _t_h_e _u_p_p_e_r/_l_o_w_e_r _t_r_i_a_n_g_u_l_a_r _p_o_r_t_i_o_n _o_f _a _m_a_t_r_i_x

_D_e_s_c_r_i_p_t_i_o_n:

     Extract or replace the upper/lower triangular portion of a matrix

_U_s_a_g_e:

     upperTriangle(x, diag=FALSE)
     upperTriangle(x, diag=FALSE) <- value
     lowerTriangle(x, diag=FALSE)
     lowerTriangle(x, diag=FALSE) <- value

_A_r_g_u_m_e_n_t_s:

       x: Matrix

    diag: Logical.  If code{TRUE}, include the matrix diagonal.

   value: Either a single value or a vector of length equal to that of
          the current upper/lower triangular.  Should be of a mode
          which  can be coerced to that of 'x'.

_V_a_l_u_e:

     'upperTriangle(x)' and 'lowerTriangle(x)' return the upper or
     lower triangle of matrix x, respectively. The assignment forms
     replace the upper or lower traingular area of the matrix with the
     provided value(s).

_A_u_t_h_o_r(_s):

     Gregory R. Warnes gregory.r.warnes@pfizer.com

_S_e_e _A_l_s_o:

     'diag'

_E_x_a_m_p_l_e_s:

       x <- matrix( 1:25, nrow=5, ncol=5)
       x
       upperTriangle(x)
       upperTriangle(x, diag=TRUE)

       lowerTriangle(x)
       lowerTriangle(x, diag=TRUE)

       upperTriangle(x) <- NA
       x

       upperTriangle(x, diag=TRUE) <- 1:15
       x

       lowerTriangle(x) <- NA
       x

       lowerTriangle(x, diag=TRUE) <- 1:15
       x

