How to converte CODA to CSV

I am using "Hierarchical Modeling of Species Communities (HMSC)", and used the "convertToCodaObject" command to view the model's empirical information (eg. average and sd). However, I'm having trouble saving the data in CSV to make some plots, for example:

Means and sd for "S1" in relation to "C2", "C3" and "C4"

S = species, C = predictor

Example of the return of the model's empirical information:

Iterations = 50100:150000
Thinning interval = 100 
Number of chains = 2 
Sample size per chain = 1000 

1. Empirical mean and standard deviation for each variable,
   plus standard error of the mean:

                                                         Mean        SD
B[(Intercept) (C1), Crax.fasciolata (S1)]           2.921e+00 4.144e+00
B[dist.water (C2), Crax.fasciolata (S1)]           -2.372e-04 3.009e-04
B[elevation (C3), Crax.fasciolata (S1)]            -2.306e-02 2.250e-02
B[api (C4), Crax.fasciolata (S1)]                  -4.552e-02 3.647e-02
B[(Intercept) (C1), Crypturellus.sp (S2)]          -7.328e-02 3.676e+00
B[dist.water (C2), Crypturellus.sp (S2)]           -1.022e-05 1.772e-04
B[elevation (C3), Crypturellus.sp (S2)]            -6.738e-03 2.129e-02
B[api (C4), Crypturellus.sp (S2)]                  -3.093e-02 1.537e-02
B[(Intercept) (C1), Cuniculus.paca (S3)]           -9.618e-02 2.852e+00
B[dist.water (C2), Cuniculus.paca (S3)]            -7.985e-05 1.608e-04
B[elevation (C3), Cuniculus.paca (S3)]             -7.255e-03 1.700e-02
B[api (C4), Cuniculus.paca (S3)]                   -9.612e-03 1.032e-02 

2. Quantiles for each variable:

                                                         2.5%        25%
B[(Intercept) (C1), Crax.fasciolata (S1)]          -4.743e+00 -1.019e-01
B[dist.water (C2), Crax.fasciolata (S1)]           -8.597e-04 -4.310e-04
B[elevation (C3), Crax.fasciolata (S1)]            -7.313e-02 -3.830e-02
B[api (C4), Crax.fasciolata (S1)]                  -1.543e-01 -5.840e-02
B[(Intercept) (C1), Crypturellus.sp (S2)]          -6.618e+00 -2.389e+00
B[dist.water (C2), Crypturellus.sp (S2)]           -3.151e-04 -1.339e-04
B[elevation (C3), Crypturellus.sp (S2)]            -5.893e-02 -2.061e-02
B[api (C4), Crypturellus.sp (S2)]                  -6.003e-02 -4.047e-02
B[(Intercept) (C1), Cuniculus.paca (S3)]           -5.745e+00 -2.160e+00

B[(Intercept) (C1), Crax.fasciolata (S1)]           1.259e+01
B[dist.water (C2), Crax.fasciolata (S1)]            2.861e-04
B[elevation (C3), Crax.fasciolata (S1)]             1.980e-02
B[api (C4), Crax.fasciolata (S1)]                   2.021e-03
B[(Intercept) (C1), Crypturellus.sp (S2)]           8.715e+00
B[dist.water (C2), Crypturellus.sp (S2)]            3.752e-04
B[elevation (C3), Crypturellus.sp (S2)]             3.157e-02
B[api (C4), Crypturellus.sp (S2)]                  -1.462e-03
B[(Intercept) (C1), Cuniculus.paca (S3)]            5.586e+00
B[dist.water (C2), Cuniculus.paca (S3)]             2.359e-04
B[elevation (C3), Cuniculus.paca (S3)]              2.618e-02
B[api (C4), Cuniculus.paca (S3)]                    1.026e-02

How can I save the data in CSV in which I can include the mean and sd values: 0.025 and 0.95, for each "S" for each "C"?

From help(convertToCodaObject) the named list of lists in the reprex fragment below would have to be reassembled as a flat file data frame like object to be saved as csv. Doesn't appear to be any function in Hmsc to do that.

#> Loading required package: coda
objectcodaObject = convertToCodaObject(TD$m)
#> $Beta
#> [[1]]
#> Markov Chain Monte Carlo (MCMC) output:
#> Start = 51 
#> End = 150 
#> Thinning interval = 1 
#>        B[(Intercept) (C1), sp_003 (S1)] B[x1 (C2), sp_003 (S1)]
#>   [1,]                        -1.400225               0.6042931
#> attr(,"class")
#> [1] "mcmc.list"

Created on 2020-07-15 by the reprex package (v0.3.0)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.