*! version 1.0.0 09nov2009
help bugwrite

Title

bugwrite -- Write data values to screen in a WinBUGS-readable format

Syntax

bugwrite
varlist
[if] [in]
[,
options]

Main
columns(integer) number of columns to display data in

space(integer) number of spaces between comma and next data value

width(integer) overall width of displayed data

file(filename) specify a file to write data to

leftpad(integer) specify number of blank spaces to the left of each row

rightpad(integer) specify number of blank spaces between last data value and right parenthesis

Options

Main

columns(integer) specifies the number of columns for the data. This option overrides width
when a value >= 1 is specified for columns. When columns is not specified, width is used, whether width
is specified or default.

space(integer) specifies the number of spaces to pad each data entry with, i.e., minimum separation
between data values and previous comma (or parenthesis for first data value). The default is
space(1). Values of space <= 0 are equivalent to space(0).

width(integer) specifies the overall width of the displayed data. This option overrides the columns
option when columns is not specified or when specified <= 0. Otherwise columns overrides
width. The default is width(88). If rightpad is specified, the actual width can be as large
as width + rightpad.

file(filename, [replace -or- append]) specifies a file to write the data to instead of writing to screen.
File names should include extensions (probably .txt, the program writes ASCII characters). Either
replace or append should be specified if the target file already exists. If the
location of the written-to file is different from the current location, then the address should be inclosed in
quotes. For example, "..\data.txt".

Description

bugwrite displays data values formatted in a way that WinBUGS understands.

Examples

. bugwrite isub in 1/25, width(30)

isub = c(1, 1, 1, 1, 1, 1, 1,
1, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 3, 3, 3,
3, 3, 3, 4)

. bugwrite isub in 1/25, space(2) c(8)

isub = c(1, 1, 1, 1, 1, 1, 1, 1,
2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 3, 3, 3, 3, 3, 3,
4)

. bugwrite isub in 1/25, c(5) l(1) r(1)

isub = c( 1, 1, 1, 1, 1,
1, 1, 1, 2, 2,
2, 2, 2, 2, 2,
2, 2, 2, 3, 3,
3, 3, 3, 3, 4 )

. bugwrite isub z in 1/25, c(5)

isub = c(1, 1, 1, 1, 1,
1, 1, 1, 2, 2,
2, 2, 2, 2, 2,
2, 2, 2, 3, 3,
3, 3, 3, 3, 4),

z = c(.1369841, .6432207, .5578017, .6047949, .684176,
.1086679, .6184582, .0610638, .5552388, .8714491,
.2551499, .0445188, .4241557, .8983462, .5219247,
.8414094, .2110077, .5644092, .2648021, .9477426,
.2769154, .1180158, .4079702, .7219492, .871691)

(Notice the comma after isub's closing parenthesis.)

Authors

James Fiedler, Universities Space Research Association

Email: james.fiedler-1@nasa.gov

Alan H. Feiveson, National Aeronautics and Space Administration

Email: alan.h.feiveson@nasa.gov