read.data {rjags} | R Documentation |
Read data for a JAGS model from a file.
read.data(file, format=c("jags","bugs"))
file |
name of a file containing a text repesentation of the data for a jags model |
format |
format of the data. See Details below |
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.data
function,
with format="jags"
, 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.data
function, with format="bugs"
reads OpenBUGS
"S-PLUS" format files and permutes the elements of arrays so that they
appear in the correct order.
Either choice of format returns a list which can be used as the
data
or inits
argument of jags.model
.
A named list of numeric vectors or arrays.
Martyn Plummer