writeDatafileR: Writes from an R list object containing data to a form...

Description Usage Arguments Details Value Author(s)

Description

Writes from R to file "towhere" text defining a list containing "DATA" in a form compatable with WinBUGS.

Usage

1
writeDatafileR(DATA, towhere = "toWinBUGS.txt", fill = 80)

Arguments

DATA

either a data frame or else a list consisting of any combination of scalars, vectors, arrays or data frames (but not lists). If a list, all list elements that are not data.frames must be named. Names of data.frames in DATA are ignored.

towhere

file to receive output. Is "toWinBUGS.txt" by default.

fill

If numeric, number of columns for output. (Default is 80.) If FALSE, output will be on one line. If TRUE, number of columns is given by .Options$width.

Details

The function performs considerable checking of DATA argument. Since WinBUGS requires numeric input, no factors or character vectors are allowed. All data must be named, either as named elements of DATA (if it is a list) or else using the names given in data frames. Data frames may contain matrices. Arrays of any dimension are rearranged to be in row-major order, as required by WinBUGS. Scientific notation is also handled properly. In particular, the number will consist of a mantissa _containing a decimal point_ followed by "E", then either "+" or "-", and finally a _two-digit_ number.

Value

Text defining a list is output to file "towhere".

Author(s)

Terry Elrod


jayverhoef/SpAReco documentation built on May 18, 2019, 5:58 p.m.