| resample {gdata} | R Documentation |
resample takes a sample of the specified size from the
elements of x using either with or without replacement.
resample(x, size, replace = FALSE, prob = NULL)
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. |
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.
~Describe the value returned If it is a LIST, use
comp1 |
Description of 'comp1' |
comp2 |
Description of 'comp2' |
...
....
~~further notes~~
~Make other sections like Warning with section{Warning }{....} ~
~~who you are~~
~put references to the literature/web site here ~
~~objects to See Also as help, ~~~
##---- 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, ...)
}