samples.coda: Writing files in CODA format

Description Usage Arguments Details Value Note See Also


This function writes files in CODA format to be processed or imported, e.g, by some other software.


samplesCoda(node, stem, beg = samplesGetBeg(), 
    end = samplesGetEnd(), firstChain = samplesGetFirstChain(), 
    lastChain = samplesGetLastChain(), thin = samplesGetThin())



Character vector of length 1, name of a variable in the model.


The filestem of the CODA files to be generated. See details.

beg, end

Arguments to select a slice of monitored values corresponding to iterations beg:end.

firstChain, lastChain

Arguments to select a sub group of chains.


to only use every thin-th value of the stored sample.


Example for argument stem: If stem = "c:/myFolder/foo", the resulting files are called ‘fooCODAchain1.txt’, ..., ‘fooCODAchainN.txt’, and ‘fooCODAindex.txt’. They are written into the tempdir() and copied to the path ‘"c:/myFolder"’.

If the variable of interest is an array, slices of the array can be selected using the notation variable[lower0:upper0, lower1:upper1, ...].

If the arguments are left at their defaults the whole sample for all chains will be used for output.


Prints ‘CODA files written’.


If the MCMC simulation has an adaptive phase it will not be possible to make inference using values sampled before the end of this phase.

See Also

BRugs, help.WinBUGS

Search within the BRugs package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.