[<--methods              package:Matrix              R Documentation

_M_e_t_h_o_d_s _f_o_r "[<-" - _A_s_s_i_g_n_i_n_g _t_o _S_u_b_s_e_t_s _f_o_r '_M_a_t_r_i_x'

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

     Methods for '"[<-"', i.e., extraction or subsetting mostly of
     matrices, in package 'Matrix'.

_M_e_t_h_o_d_s:

     There are more than these:

     _x = "_M_a_t_r_i_x", _i = "_m_i_s_s_i_n_g", _j = "_m_i_s_s_i_n_g", _v_a_l_u_e= "_A_N_Y" is
          currently a simple fallback method implementation which
          ensures "readable" error messages.

     _x = "_M_a_t_r_i_x", _i = "_A_N_Y", _j = "_A_N_Y", _v_a_l_u_e= "_A_N_Y" currently gives
          an error 

     _x = "_d_e_n_s_e_M_a_t_r_i_x", _i = "_i_n_d_e_x", _j = "_m_i_s_s_i_n_g", _v_a_l_u_e= "_n_u_m_e_r_i_c" ..
          . 

     _x = "_d_e_n_s_e_M_a_t_r_i_x", _i = "_i_n_d_e_x", _j = "_i_n_d_e_x", _v_a_l_u_e= "_n_u_m_e_r_i_c" ... 

     _x = "_d_e_n_s_e_M_a_t_r_i_x", _i = "_m_i_s_s_i_n_g", _j = "_i_n_d_e_x", _v_a_l_u_e= "_n_u_m_e_r_i_c" ..
          . 

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

     '[-methods' for subsetting '"Matrix"' objects; the 'index' class;
     'Extract' about the standard subset assignment (and extraction).

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

     (m <- Matrix(round(rnorm(7*4),2), nrow = 7))
     stopifnot(identical(m, m[]))
     m[2, 3]   # simple number
     m[2, 3:4] # simple numeric of length 2

     m[2, 3:4, drop=FALSE] # sub matrix of class 'dgeMatrix'
     m[-(4:7), 3:4]        # dito; the upper right corner of 'm'

     ## rows or columns only:
     m[1,]     # first row, as simple numeric vector
     m[,2]     # 2nd column
     m[,1:2]   # sub matrix of first two columns
     m[-(1:6),, drop=FALSE] # not the first 6 rows, i.e. only the 7th

