Last data update: 2014.03.03

R: Simple Random Sampling
SRSR Documentation

Simple Random Sampling

Description

Computes all possible samples from a given population using simple random sampling.

Usage

SRS(POPvalues, n)

Arguments

POPvalues

vector containing the population values

n

the sample size

Value

Returns a matrix containing the possible simple random samples of size n taken from a population POPvalues.

Author(s)

Alan T. Arnholt

See Also

Combinations

Examples

SRS(c(5,8,3),2)
    # The rows in the matrix list the values for the 3 possible
    # simple random samples of size 2 from the population of 5,8, and 3.

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(PASWR)
Loading required package: e1071
Loading required package: MASS
Loading required package: lattice
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/PASWR/SRS.Rd_%03d_medium.png", width=480, height=480)
> ### Name: SRS
> ### Title: Simple Random Sampling
> ### Aliases: SRS
> ### Keywords: arith
> 
> ### ** Examples
> 
> SRS(c(5,8,3),2)
     [,1] [,2]
[1,]    5    8
[2,]    5    3
[3,]    8    3
>     # The rows in the matrix list the values for the 3 possible
>     # simple random samples of size 2 from the population of 5,8, and 3.
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>