blocksample: Block sampling

Description Usage Arguments Value Author(s) Examples

View source: R/blocksample.R

Description

Sample blockwise from clustered data

Usage

1
blocksample(data, size, idvar = "id", replace = TRUE, ...)

Arguments

data

Data frame

idvar

Column defining the clusters

size

Size of samples

replace

Logical indicating wether to sample with replacement

...

additional arguments to lower level functions

Value

data.frame

Author(s)

Klaus K. Holst

Examples

1
2
3
4
5
6
7
8
d <- data.frame(x=rnorm(5), z=rnorm(5), id=c(4,10,10,5,5), v=rnorm(5))
(dd <- blocksample(d,size=20))
attributes(dd)$id

## Not run: 
blocksample(data.table::data.table(d),1e6)

## End(Not run)

mets documentation built on May 31, 2017, 1:52 a.m.

Search within the mets package
Search all R packages, documentation and source code