resample                package:gdata                R Documentation

_C_o_n_s_i_s_t_e_n_t _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

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

     'resample' takes a sample of the specified size from the elements
     of 'x' using either with or without replacement.

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

     resample(x, size, replace = FALSE, prob = NULL)

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

       x: A numeric, complex, character or logical vector from which to
          choose.

    size: Non-negative integer giving the number of items to choose.

 replace: Should sampling be with replacement?

    prob: A vector of probability weights for obtaining the elements of
          the vector being sampled.

_D_e_t_a_i_l_s:

     'resample' differs from the S/R 'sample' function in 'resample'
     always considers 'x' to be a vector of elements to select from,
     while 'sample' treats a vector of length one as a special case and
     samples from '1:x'.  Otherwise, the functions have identical
     behavior.

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

     ~Describe the value returned If it is a LIST, use 

  comp1 : Description of 'comp1'

  comp2 : Description of 'comp2'

     ...

_W_a_r_n_i_n_g:

     ....

_N_o_t_e:

     ~~further notes~~ 

     ~Make other sections like Warning with \section{Warning }{....} ~

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

     ~~who you are~~

_R_e_f_e_r_e_n_c_e_s:

     ~put references to the literature/web site here ~

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

     ~~objects to See Also as 'help', ~~~

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

     ##---- Should be DIRECTLY executable !! ----
     ##-- ==>  Define data, use random,
     ##--    or do  help(data=index)  for the standard data sets.

     ## The function is currently defined as
     function(x, n, ...)
       {
         if(length(x)==1)
           {
             if(n==1)
               x
             else
               stop("Requested sample of size ", n, " from list of length 1")
           }
         else
           sample(x, n, ...)
       }

