I used R dump()
to create a data.txt file as specified by the latest JAGS manual, but I keep running into this error:
Reading data file data.txt
syntax error, unexpected LIST, expecting DOUBLE or NA or ASINTEGER or 'c'
The data.txt produced by dump()
, from which I have removed the "L" assigned by R:
M <- 4
N <- 2
x <- structure(list(Var1 = c(0, 1, 0, 1), Var2 = c(0, 0, 1, 1)), .Names = c("Var1",
"Var2"), out.attrs = structure(list(dim = c(2, 2), dimnames = structure(list(
Var1 = c("Var1=0", "Var1=1"), Var2 = c("Var2=0", "Var2=1"
)), .Names = c("Var1", "Var2"))), .Names = c("dim", "dimnames"
)), class = "data.frame", row.names = c(NA, -4))
counts <- c(377558, 1001, 2000, 2000)
total <- 382559
If I remove x
, the data will import correctly, but obviously that is not what I want. The strangest part is that if using the RJAGS
and R2JAGS
packages instead, the whole thing works fine. Does anyone know how to format this data to work in JAGS?