njtierney / mmcc

Fast, tidy functions for mcmc diagnostics and summaries, built with data.table
http://mmcc.njtierney.com/
Other
24 stars 5 forks source link

mcmc_to_dt works with "mcmc.list" but fails with class "mcmc" #41

Open njtierney opened 5 years ago

njtierney commented 5 years ago

So it works with mcmc.list

library(coda)
library(mmcc)
data(line)

class(line)
#> [1] "mcmc.list"
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

But fails with "mcmc"

class(line$line1)
#> [1] "mcmc"
mcmc_to_dt(line$line1)
#> Error in UseMethod("mcmc_to_dt"): no applicable method for 'mcmc_to_dt' applied to an object of class "mcmc"

Created on 2019-02-15 by the reprex package (v0.2.1)