read.jagsdata {rjags}R Documentation

Read data files for jags models


Read data for a JAGS model from a file.





name of a file containing a text repesentation of the data for a jags model


The command line interface for JAGS reads data and initial values from a text file. The data format used for jags data files is the same as the R dump function. Thus the data values can be read into an R session using the source function, but this will create objects in the global environment. The read.jagsdata function is a simple wrapper that reads the data into a list instead.

OpenBUGS also reads data and initial values from a text file. The format of these files is described as "S-PLUS" format by the OpenBUGS authors. It superficially resembles the format used by the dput function (and in fact can be parsed by the dget function). However, in BUGS "S-PLUS" format, arrays are stored in row-major order instead of the column-major order used by R. The read.bugsdata function reads OpenBUGS "S-PLUS" format files and permutes the elements of arrays so that they appear in the correct order.

Either function returns a list which can be used as the data or inits argument of jags.model.


A named list of numeric vectors or arrays.


Earlier versions of the rjags package had a function which read data in either format, but the function name was ambiguous (There are many data file format in R) so this is now deprecated.


Martyn Plummer

[Package rjags version 4-13 Index]