zmatrix               package:zmatrix               R Documentation

_Z_e_r_o-_o_f_f_s_e_t _m_a_t_r_i_c_e_s

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

     Allows operations with zero-offset matrices.

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

     m[i], m[i, j], m[, j], m[i, j, drop=TRUE]
     zmatrix(...)
     as.zmatrix(m)
     as.matrix.zmatrix(m)
     is.zmatrix(m)
     print.zmatrix(m, ...)

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

    i, j: Indices for rows and columns

       m: A matrix, possibly of class `zmatrix'

    drop: Lose dimensions of length 1?

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

     With a zero-offset matrix the rows and columns are numbered from
     zero.  `zmatrix' creates a zero-offset matrix of class `zmatrix',
     `as.zmatrix' converts an existing matrix to a zero-offset matrix,
     and `as.matrix' converts it back again. Subscripting a zero-offset
     matrix does not return a zero-offset matrix.

_N_o_t_e:

     The print method is provided to give zero-index row and column
     names in the absence of specified names.

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

     Jonathan Rougier, J.C.Rougier@durham.ac.uk, following assistance
     from Brian Ripley.

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

     `matrix'

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

     fred <- matrix(1:12, 3, 4)
     is.zmatrix(fred)                # Not yet!
     fred <- as.zmatrix(fred)
     fred; print.default(fred)       # note the labels

     fred[2, ] <- NA; fred           # sets the third row
     fred[, -(0:2)] <- NA; fred      # all bar the first three cols

     fred[0, ]                       # a vector
     fred[0, , drop=FALSE]           # a matrix
     rownames(fred) <- LETTERS[1:3]
     fred["A", 0:2]                  # mixture of names and indices

