Sampling with replacement
s = sample(n,X,orient)
positive integer (size of sample)
matrix. Samples will be extracted from this matrix.
Optional parameter. Admissible values are {'*'}, 1, 2, 'r' or 'c'. The orientation to sample rows or columns. See Description below.
vector or matrix containing sample
This function returns a vector or matrix. It contains
a random sample of n extractions, with replacement, from
the matrix X.
s = sample(n, X) (or s = sample(n, X, '*')) returns a vector s
whose values are a random sample of n values,
extracted with replacement, from X.
s = sample(n, X, 'r') (or, equivalently, s = sample(n, X, 1))
returns a matrix of size size(X,'r') * n. It contains a
random sample of n rows, extracted with replacement, from
the rows of X.
s = sample(n, X, 'c') (or, equivalently, s = sample(n, X, 2))
returns a matrix of size n * size(X, 'c'). It contains a
random sample of n columns, extracted with replacement
from the columns of X.
sample is based on grand for generating the random samples. Use grand("setsd", seed) to change the seed for samplef.