srs.sample | R Documentation |
With this function you receive a simple random sample consisting on a list of the instances index
srs.sample(N, n, replace = FALSE, data)
N |
Number of instances of the data set. |
n |
Number of instances of the returning sample. |
replace |
Whether the sample to be taken can have repeated instances or not. |
data |
Optional matrix or data.frame containing the population data. If specified an object of same class as data will be returned with sample instances. |
List of size n with numbers from 1 to N indicating the index of the data set's instances to be taken.
srs.sample(10,3)
data<-matrix(data=c(1:24), nrow=8)
N<-dim(data)[1]
sample<-srs.sample(N, 3, data = data)
sample
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.