Skip to contents

Select a subset of variables from an [coda::mcmc()] or [coda::mcmc.list()] object. Variables with names starting with one of the strings in `prefixes` are selected.

Usage

select_from_mcmc(x, prefixes)

Arguments

x

a `mcmc` object

prefixes

character vector

Value

A `mcmc` object with only the variables

Examples

require(coda)
data(line) # data from package coda
coda::varnames(line)
#> [1] "alpha" "beta"  "sigma"
new_line <- select_from_mcmc(line, c("al", "si"))
coda::varnames(new_line)
#> [1] "alpha" "sigma"