read.jagsdata: Read data files for jags models

Description Usage Arguments Details Value Note Author(s)

View source: R/read.data.R

Description

Read data for a JAGS model from a file.

Usage

1
2

Arguments

file

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

Details

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.

Value

A named list of numeric vectors or arrays.

Note

Earlier versions of the rjags package had a read.data 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.

Author(s)

Martyn Plummer


rjags documentation built on Nov. 6, 2019, 5:07 p.m.