home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / UNIX / Educational / R-0.49-MI / R-0.49-I / help / base / sweep < prev    next >
Encoding:
Text File  |  1997-04-23  |  920 b   |  38 lines

  1.     
  2.     _S_w_e_e_p _o_u_t _A_r_r_a_y _S_u_m_m_a_r_i_e_s
  3.     
  4.          sweep(x, MARGIN, STATS, FUN="-", ...)
  5.     
  6.     _A_r_g_u_m_e_n_t_s:
  7.     
  8.                x : an array.
  9.     
  10.           MARGIN : a giving the extents of x which correspond to
  11.                    STATS.
  12.     
  13.            STATS : the summary statistic which is to be swept
  14.                    out.
  15.     
  16.              FUN : the function to be used to carry out the
  17.                    sweep.  In the case of binary operators such
  18.                    as "/" etc., the function name must be
  19.                    quoted.
  20.     
  21.              ... : optional arguments to FUN.
  22.     
  23.     _V_a_l_u_e:
  24.     
  25.          An array with the same shape as x, but with the summary
  26.          statistics swept out.
  27.     
  28.     _S_e_e _A_l_s_o:
  29.     
  30.          apply.
  31.     
  32.     _E_x_a_m_p_l_e_s:
  33.     
  34.          data(attitude)
  35.          med.att <- apply(attitude, 2, median)
  36.          sweep(data.matrix(attitude), 2, med.att)# subtract the column medians
  37.     
  38.