`mcmc_to_dt` use data.table to return a tidy dataframe from an "mcmc.list" object

mcmc_to_dt(mcmc_object, colnames = NULL)

Arguments

mcmc_object

an object of class "mcmc.list", as you would find with fitting a model using `jags.model()`, and `coda.samples`

colnames

which parameters we want from `mcmc_object`, if `NULL` then all columns get selected

Value

a tidy data.table dataframe of MCMC sample

Examples

library(coda) data(line) mcmc_to_dt(line)
#> iteration chain parameter value #> 1: 1 1 alpha 7.173130 #> 2: 2 1 alpha 2.952530 #> 3: 3 1 alpha 3.669890 #> 4: 4 1 alpha 3.315220 #> 5: 5 1 alpha 3.705440 #> --- #> 1196: 196 2 sigma 1.306930 #> 1197: 197 2 sigma 0.846828 #> 1198: 198 2 sigma 0.465129 #> 1199: 199 2 sigma 0.672417 #> 1200: 200 2 sigma 0.639787