Random Sampling in R

[code language="splus"]

A few quick notes on random sampling in R:

#random Sample of 5 numbers from 1:500 sample(500,5)

#input a vector x x<-c(22, 23,21,34,67,78,45,34,23,45,56,76,56)

#sample from x with replacement sample(x,5,replace=T)

#create random vector, y, of random permutation of 1:15 y <- sample(15)

#create a vector, y, to contain 5 through 15. Then sample randomly y <- sample(5:15) [/code]

Get notified about new posts