powered by
With this function you receive a simple random sample consisting on a list of the instances index
srs.sample(N, n, replace = FALSE, data)
List of size n with numbers from 1 to N indicating the index of the data set's instances to be taken.
Number of instances of the data set.
Number of instances of the returning sample.
Whether the sample to be taken can have repeated instances or not.
Optional matrix or data.frame containing the population data. If specified an object of same class as data will be returned with sample instances.
srs.sample(10,3) data<-matrix(data=c(1:24), nrow=8) N<-dim(data)[1] sample<-srs.sample(N, 3, data = data) sample
Run the code above in your browser using DataLab