Learn R Programming

Boom (version 0.9.15)

thin: Thin the rows of a matrix

Description

Systematic sampling of every thin'th row of a matrix or vector. Useful for culling MCMC output or denoising a plot.

Usage

thin(x, thin)

Value

The thinned vector, matrix, or array is returned.

Arguments

x

The array to be thinned. The first dimension is the one sampled over.

thin

The frequency of observations to keep. With thin=10 you will keep every 10th observation.

Author

Steven L. Scott

Examples

Run this code

x <- rnorm(100)
thin(x, 10)
# returns a 10 vector

y <- matrix(rnorm(200), ncol=2)
thin(y, 10)
# returns a 10 by 2 matrix

Run the code above in your browser using DataLab