resample {gdata}R Documentation

Consistent Random Samples and Permutations

Description

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

Usage

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

Arguments

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.

Details

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.

Value

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

comp1 Description of 'comp1'
comp2 Description of 'comp2'

...

Warning

....

Note

~~further notes~~

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

Author(s)

~~who you are~~

References

~put references to the literature/web site here ~

See Also

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

Examples

##---- 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, ...)
  }

[Package gdata version 2.2.0 Index]