srs.sample {samplingR}R Documentation

Simple Random Sample

Description

With this function you receive a simple random sample consisting on a list of the instances index

Usage

srs.sample(N, n, replace = FALSE, data)

Arguments

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.

Value

List of size n with numbers from 1 to N indicating the index of the data set's instances to be taken.

Examples

srs.sample(10,3)


data<-matrix(data=c(1:24), nrow=8)
N<-dim(data)[1]
sample<-srs.sample(N, 3, data = data)
sample


[Package samplingR version 1.0.1 Index]