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 / sample < prev    next >
Encoding:
Text File  |  1997-04-23  |  710 b   |  26 lines

  1.     
  2.     _R_a_n_d_o_m _S_a_m_p_l_e_s _a_n_d _P_e_r_m_u_t_a_t_i_o_n_s
  3.     
  4.          sample(x, size, replace=FALSE)
  5.     
  6.     _D_e_s_c_r_i_p_t_i_o_n:
  7.     
  8.          sample takes a sample of the specified size from the
  9.          elements of x using either with or without replacement
  10.          sampling according to the value of replace.
  11.     
  12.          By default size is equal to length(x) so that sample(x)
  13.          generates a random permutation of the elements of x.
  14.     
  15.          If x has length 1, sampling takes place from 1:x.
  16.     
  17.     _E_x_a_m_p_l_e_s:
  18.     
  19.          # a random permutation
  20.          sample(x)
  21.          # bootstrap sampling
  22.          sample(x,replace=TRUE)
  23.          # 100 Bernoulli trials
  24.          sample(c(0,1), 100)
  25.     
  26.