[R] sample() from (un-)sorted vectors

saschaview at gmail.com saschaview at gmail.com
Wed Aug 15 18:11:15 CEST 2012


Hello,

Vector y is an alphabetically sorted version of vector x. Will both 
samples, X and Y, be "absolutely" random or will they have systematic 
differences? And: Should I sort or shuffle a vector before sampling?

Thank you, *S*

x <- as.factor(LETTERS[sequence(10:1)])
y <- sort(x)
X <- sample(x, 5)
Y <- sample(y, 5)


-- 
Sascha Vieweg, saschaview at gmail.com



More information about the R-help mailing list