Statistical Analysis: an Introduction using R/R/Random sampling

Random sampling
From the help page, we have seen that the sample function can take a number of different arguments. x must be a vector of items, size must be a number. Since 1:6 gives a vector of the numbers from 1 to 6, we can set x&#61;1:6 and size&#61;5. Here are 5 examples (note that the first 4 are equivalent, although the actual result will differ due to chance effects when sampling ).