stratsampInds: create vector of indices constituting a stratified sample...

Description Usage Arguments Value Note Examples

View source: R/infra.R

Description

create vector of indices constituting a stratified sample using a discrete variable to partition strata

Usage

1
stratsampInds(strata, nperstrat = 300)

Arguments

strata

atomic vector

nperstrat

size of sample to be retrieved

Value

numeric vector of indices

Note

fails if any stratum has size less than 'nperstrat'

Examples

1
2
3
4
5
mytags = c(1,1,1,2,2,3,1,1,1,2,2,3,3,3,3,2,2,2)
mydat = 1:length(mytags)
names(mydat) = mytags
inds = stratsampInds(mytags, nperstrat=2)
mydat[inds]

vjcitn/pcmp documentation built on May 25, 2019, 2:21 p.m.