[R] R2WinBUGS "expected collection operator c" error

Uwe Ligges ligges at statistik.tu-dortmund.de
Thu Apr 3 00:12:32 CEST 2014


This is probably a BUGS rather than an R problem, hence better for a 
BUGS mailing list. But if we should help, then we need at least the 
modelfile.

Best,
Uwe Ligges



On 02.04.2014 19:10, zumacrume wrote:
> Hi all,
> I am currently in a Bayesian Modeling course and am trying to implement an
> analog representation model using R, WinBUGS, and R2WinBUGS.  I'm currently
> stuck banging my head against an "expected collection operator c" error.  I
> am working off of a template code, and I swear I haven't moved any
> collection operators from the original code.
> Here is what my script looks like in R:
> ########################################################
>
> # clears workspace:
> rm(list=ls(all=TRUE))
>
> # sets working directories:
> setwd("C:\\Users\\Nick\\Desktop\\modeling")
> library(R2WinBUGS)
> bugsdir = "C:/Program Files/WinBUGS14"
>
> # read the data
>
> g   = matrix(scan("g.txt", sep=","), ncol=144, nrow=3, byrow=T)
> q   = matrix(scan("q.txt", sep=","), ncol=144, nrow=3, byrow=T)
> S   = 3         # number of subjects
> Q   = 144 # number of questions for each child
> N   = 9 # maximum numbers of item list
>
> data  = list("g", "q", "S", "Q", "N") # to be passed on to WinBUGS
> myinits =	list(
>    list(sigma = rep(1,S), pitmp=rep(1/N, N)))
>
> # parameters to be monitored:	
> parameters = c("pp","ppb","sigma")
>
> # NB. even with only 1000 iterations, the sampling can take a long time!
> # The following command calls WinBUGS with specific options.
> # For a detailed description see Sturtz, Ligges, & Gelman (2005).
> samples = bugs(data, inits=myinits, parameters,
> 	 			model.file ="NumberConcept_2_data.txt",
> 	 			n.chains=1, n.iter=1000, n.burnin=100, n.thin=1,
> 	 			DIC=T, bugs.directory=bugsdir,
> 	 			codaPkg=F, debug=T)
> # Now the values for the monitored parameters are in the "samples" object,
> # ready for inspection.
>
> samples$summary
>
> #######################################################
>
> and here is the log file file from WinBUGS after R2WinBUGS passes it over:
>
> #######################################################
> display(log)
> check(C:/Users/Nick/AppData/Local/Temp/RtmpIRZ1dh/NumberConcept_2_data.txt)
> model is syntactically correct
> data(C:/Users/Nick/AppData/Local/Temp/RtmpIRZ1dh/data.txt)
> expected collection operator c
> compile(1)
> inits(1,C:/Users/Nick/AppData/Local/Temp/RtmpIRZ1dh/inits1.txt)
> command #Bugs:inits cannot be executed (is greyed out)
> gen.inits()
> command #Bugs:gen.inits cannot be executed (is greyed out)
> thin.updater(1)
> update(100)
> command #Bugs:update cannot be executed (is greyed out)
> set(pp)
> command #Bugs:set cannot be executed (is greyed out)
> set(ppb)
> command #Bugs:set cannot be executed (is greyed out)
> set(sigma)
> command #Bugs:set cannot be executed (is greyed out)
> set(deviance)
> command #Bugs:set cannot be executed (is greyed out)
> dic.set()
> command #Bugs:dic.set cannot be executed (is greyed out)
> update(900)
> command #Bugs:update cannot be executed (is greyed out)
> coda(*,C:/Users/Nick/AppData/Local/Temp/RtmpIRZ1dh/coda)
> command #Bugs:coda cannot be executed (is greyed out)
> stats(*)
> command #Bugs:stats cannot be executed (is greyed out)
> dic.stats()
>
> DIC
> history(*,C:/Users/Nick/AppData/Local/Temp/RtmpIRZ1dh/history.odc)
> command #Bugs:history cannot be executed (is greyed out)
> save(C:/Users/Nick/AppData/Local/Temp/RtmpIRZ1dh/log.odc)
> save(C:/Users/Nick/AppData/Local/Temp/RtmpIRZ1dh/log.txt)
>
> #################################################################
> WinBUGS also opens up a data window that looks like this:
> #################################################################
>
> list(g= structure(.Data= c(1.00000E+00, 1.00000E+00, 1.00000E+00,
> 1.00000E+00, 1.00000E+00, 1.00000E+00, 2.00000E+00, 1.00000E+00,
> 2.00000E+00, 2.00000E+00, 2.00000E+00, 1.00000E+00, 2.00000E+00,
> 2.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00, 1.00000E+00,
> 2.00000E+00, 2.00000E+00, 1.00000E+00, 2.00000E+00, 2.00000E+00,
> 2.00000E+00, 2.00000E+00, 1.00000E+00, 2.00000E+00, 1.00000E+00,
> 2.00000E+00, 1.00000E+00, 1.00000E+00, 2.00000E+00, 2.00000E+00,
> 1.00000E+00, 2.00000E+00, 1.00000E+00, 2.00000E+00, 2.00000E+00,
> 1.00000E+00, 1.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00,
> 1.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00,
> 2.00000E+00, 2.00000E+00, 1.00000E+00, 2.00000E+00, 1.00000E+00,
> 2.00000E+00, 2.00000E+00, 2.00000E+00, 1.00000E+00, 2.00000E+00,
> 2.00000E+00, 1.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00,
> 2.00000E+00, 2.00000E+00, 1.00000E+00, 2.00000E+00, 2.00000E+00,
> 2.00000E+00, 2.00000E+00, 1.00000E+00, 2.00000E+00, 2.00000E+00,
> 2.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00,
> 1.00000E+00, 2.00000E+00, 1.00000E+00, 1.00000E+00, 2.00000E+00,
> 2.00000E+00, 2.00000E+00, 2.00000E+00, 1.00000E+00, 1.00000E+00,
> 2.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00,
> 2.00000E+00, 2.00000E+00, 2.00000E+00, 1.00000E+00, 2.00000E+00,
> 1.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00,
> 1.00000E+00, 2.00000E+00, 1.00000E+00, 2.00000E+00, 2.00000E+00,
> 1.00000E+00, 1.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00,
> 2.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00,
> 2.00000E+00, 1.00000E+00, 2.00000E+00, 2.00000E+00, 1.00000E+00,
> 2.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00, 1.00000E+00,
> 2.00000E+00, 1.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00,
> 2.00000E+00, 2.00000E+00, 2.00000E+00, 1.00000E+00, 2.00000E+00,
> 2.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00,
> 2.00000E+00, 1.00000E+00, 1.00000E+00, 1.00000E+00, 2.00000E+00,
> 2.00000E+00, 2.00000E+00, 1.00000E+00, 2.00000E+00, 2.00000E+00,
> 2.00000E+00, 1.00000E+00, 2.00000E+00, 1.00000E+00, 2.00000E+00,
> 2.00000E+00, 2.00000E+00, 1.00000E+00, 2.00000E+00, 2.00000E+00,
> 2.00000E+00, 2.00000E+00, 2.00000E+00, 1.00000E+00, 2.00000E+00,
> 2.00000E+00, 1.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00,
> 2.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00,
> 2.00000E+00, 1.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00,
> 2.00000E+00, 2.00000E+00, 1.00000E+00, 2.00000E+00, 2.00000E+00,
> 1.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00, 1.00000E+00,
> 2.00000E+00, 2.00000E+00, 2.00000E+00, 1.00000E+00, 2.00000E+00,
> 2.00000E+00, 2.00000E+00, 2.00000E+00, 1.00000E+00, 2.00000E+00,
> 2.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00, 1.00000E+00,
> 2.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00, 1.00000E+00,
> 1.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00,
> 2.00000E+00, 2.00000E+00, 2.00000E+00, 1.00000E+00, 2.00000E+00,
> 1.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00,
> 2.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00,
> 2.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00,
> 2.00000E+00, 1.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00,
> 1.00000E+00, 2.00000E+00, 2.00000E+00, 1.00000E+00, 2.00000E+00,
> 2.00000E+00, 2.00000E+00, 2.00000E+00, 1.00000E+00, 2.00000E+00,
> 2.00000E+00, 2.00000E+00, 2.00000E+00, 1.00000E+00, 2.00000E+00,
> 2.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00,
> 2.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00,
> 2.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00, 1.00000E+00,
> 2.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00,
> 2.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00,
> 1.00000E+00, 2.00000E+00, 1.00000E+00, 1.00000E+00, 2.00000E+00,
> 1.00000E+00, 1.00000E+00, 2.00000E+00, 1.00000E+00, 1.00000E+00,
> 1.00000E+00, 1.00000E+00, 2.00000E+00, 1.00000E+00, 2.00000E+00,
> 1.00000E+00, 1.00000E+00, 2.00000E+00, 2.00000E+00, 1.00000E+00,
> 1.00000E+00, 2.00000E+00, 1.00000E+00, 2.00000E+00, 1.00000E+00,
> 2.00000E+00, 2.00000E+00, 1.00000E+00, 2.00000E+00, 2.00000E+00,
> 1.00000E+00, 1.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00,
> 2.00000E+00, 1.00000E+00, 2.00000E+00, 1.00000E+00, 1.00000E+00,
> 1.00000E+00, 2.00000E+00, 1.00000E+00, 2.00000E+00, 1.00000E+00,
> 2.00000E+00, 2.00000E+00, 1.00000E+00, 1.00000E+00, 2.00000E+00,
> 2.00000E+00, 1.00000E+00, 2.00000E+00, 2.00000E+00, 1.00000E+00,
> 1.00000E+00, 1.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00,
> 2.00000E+00, 2.00000E+00, 1.00000E+00, 1.00000E+00, 2.00000E+00,
> 1.00000E+00, 2.00000E+00, 1.00000E+00, 2.00000E+00, 2.00000E+00,
> 2.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00, 1.00000E+00,
> 2.00000E+00, 1.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00,
> 2.00000E+00, 2.00000E+00, 1.00000E+00, 2.00000E+00, 1.00000E+00,
> 2.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00,
> 1.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00, 1.00000E+00,
> 1.00000E+00, 2.00000E+00, 1.00000E+00, 1.00000E+00, 1.00000E+00,
> 1.00000E+00, 2.00000E+00, 1.00000E+00, 1.00000E+00, 1.00000E+00,
> 2.00000E+00, 2.00000E+00, 1.00000E+00, 2.00000E+00, 1.00000E+00,
> 2.00000E+00, 1.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00,
> 2.00000E+00, 1.00000E+00, 2.00000E+00, 2.00000E+00, 1.00000E+00,
> 2.00000E+00, 2.00000E+00, 1.00000E+00, 1.00000E+00, 2.00000E+00,
> 1.00000E+00, 2.00000E+00, 2.00000E+00, 1.00000E+00, 2.00000E+00,
> 2.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00,
> 1.00000E+00, 2.00000E+00, 1.00000E+00, 2.00000E+00, 2.00000E+00,
> 1.00000E+00, 2.00000E+00, 1.00000E+00, 2.00000E+00, 2.00000E+00,
> 1.00000E+00, 2.00000E+00, 2.00000E+00, 2.00000E+00), .Dim=c(3, 144)), q=
> structure(.Data= c(4.00000E+00, 5.00000E+00, 3.00000E+00, 8.00000E+00,
> 1.00000E+00, 5.00000E+00, 4.00000E+00, 4.00000E+00, 3.00000E+00,
> 3.00000E+00, 2.00000E+00, 1.00000E+00, 1.00000E+00, 4.00000E+00,
> 5.00000E+00, 2.00000E+00, 3.00000E+00, 2.00000E+00, 1.00000E+00,
> 1.00000E+00, 2.00000E+00, 3.00000E+00, 7.00000E+00, 6.00000E+00,
> 5.00000E+00, 4.00000E+00, 7.00000E+00, 1.00000E+00, 1.00000E+00,
> 3.00000E+00, 6.00000E+00, 2.00000E+00, 6.00000E+00, 2.00000E+00,
> 2.00000E+00, 1.00000E+00, 3.00000E+00, 3.00000E+00, 4.00000E+00,
> 1.00000E+00, 7.00000E+00, 2.00000E+00, 2.00000E+00, 3.00000E+00,
> 4.00000E+00, 1.00000E+00, 3.00000E+00, 5.00000E+00, 6.00000E+00,
> 2.00000E+00, 6.00000E+00, 4.00000E+00, 2.00000E+00, 2.00000E+00,
> 5.00000E+00, 5.00000E+00, 1.00000E+00, 1.00000E+00, 4.00000E+00,
> 5.00000E+00, 3.00000E+00, 3.00000E+00, 1.00000E+00, 1.00000E+00,
> 7.00000E+00, 2.00000E+00, 1.00000E+00, 8.00000E+00, 4.00000E+00,
> 2.00000E+00, 1.00000E+00, 6.00000E+00, 4.00000E+00, 2.00000E+00,
> 3.00000E+00, 4.00000E+00, 2.00000E+00, 5.00000E+00, 1.00000E+00,
> 7.00000E+00, 2.00000E+00, 3.00000E+00, 5.00000E+00, 3.00000E+00,
> 6.00000E+00, 5.00000E+00, 1.00000E+00, 1.00000E+00, 3.00000E+00,
> 5.00000E+00, 1.00000E+00, 6.00000E+00, 2.00000E+00, 6.00000E+00,
> 4.00000E+00, 7.00000E+00, 4.00000E+00, 2.00000E+00, 1.00000E+00,
> 3.00000E+00, 2.00000E+00, 1.00000E+00, 1.00000E+00, 1.00000E+00,
> 3.00000E+00, 2.00000E+00, 4.00000E+00, 8.00000E+00, 1.00000E+00,
> 1.00000E+00, 5.00000E+00, 6.00000E+00, 4.00000E+00, 7.00000E+00,
> 1.00000E+00, 6.00000E+00, 7.00000E+00, 5.00000E+00, 3.00000E+00,
> 3.00000E+00, 4.00000E+00, 4.00000E+00, 3.00000E+00, 3.00000E+00,
> 2.00000E+00, 5.00000E+00, 3.00000E+00, 2.00000E+00, 6.00000E+00,
> 1.00000E+00, 2.00000E+00, 3.00000E+00, 1.00000E+00, 5.00000E+00,
> 1.00000E+00, 2.00000E+00, 1.00000E+00, 4.00000E+00, 2.00000E+00,
> 8.00000E+00, 2.00000E+00, 4.00000E+00, 1.00000E+00, 2.00000E+00,
> 1.00000E+00, 1.00000E+00, 3.00000E+00, 7.00000E+00, 3.00000E+00,
> 1.00000E+00, 3.00000E+00, 2.00000E+00, 4.00000E+00, 7.00000E+00,
> 4.00000E+00, 1.00000E+00, 1.00000E+00, 5.00000E+00, 3.00000E+00,
> 6.00000E+00, 2.00000E+00, 1.00000E+00, 1.00000E+00, 2.00000E+00,
> 2.00000E+00, 2.00000E+00, 6.00000E+00, 5.00000E+00, 8.00000E+00,
> 4.00000E+00, 3.00000E+00, 5.00000E+00, 3.00000E+00, 4.00000E+00,
> 6.00000E+00, 4.00000E+00, 5.00000E+00, 1.00000E+00, 2.00000E+00,
> 2.00000E+00, 1.00000E+00, 3.00000E+00, 2.00000E+00, 5.00000E+00,
> 5.00000E+00, 1.00000E+00, 4.00000E+00, 4.00000E+00, 1.00000E+00,
> 3.00000E+00, 1.00000E+00, 2.00000E+00, 4.00000E+00, 5.00000E+00,
> 3.00000E+00, 2.00000E+00, 1.00000E+00, 5.00000E+00, 6.00000E+00,
> 3.00000E+00, 1.00000E+00, 2.00000E+00, 4.00000E+00, 8.00000E+00,
> 2.00000E+00, 7.00000E+00, 4.00000E+00, 2.00000E+00, 1.00000E+00,
> 6.00000E+00, 7.00000E+00, 3.00000E+00, 2.00000E+00, 1.00000E+00,
> 6.00000E+00, 3.00000E+00, 2.00000E+00, 7.00000E+00, 3.00000E+00,
> 2.00000E+00, 3.00000E+00, 3.00000E+00, 7.00000E+00, 1.00000E+00,
> 3.00000E+00, 5.00000E+00, 5.00000E+00, 5.00000E+00, 6.00000E+00,
> 4.00000E+00, 6.00000E+00, 2.00000E+00, 2.00000E+00, 1.00000E+00,
> 4.00000E+00, 1.00000E+00, 8.00000E+00, 4.00000E+00, 5.00000E+00,
> 1.00000E+00, 4.00000E+00, 6.00000E+00, 2.00000E+00, 1.00000E+00,
> 3.00000E+00, 3.00000E+00, 1.00000E+00, 4.00000E+00, 2.00000E+00,
> 1.00000E+00, 2.00000E+00, 1.00000E+00, 3.00000E+00, 7.00000E+00,
> 8.00000E+00, 2.00000E+00, 2.00000E+00, 3.00000E+00, 2.00000E+00,
> 6.00000E+00, 1.00000E+00, 2.00000E+00, 4.00000E+00, 5.00000E+00,
> 4.00000E+00, 3.00000E+00, 3.00000E+00, 6.00000E+00, 2.00000E+00,
> 1.00000E+00, 1.00000E+00, 2.00000E+00, 1.00000E+00, 5.00000E+00,
> 1.00000E+00, 4.00000E+00, 4.00000E+00, 6.00000E+00, 3.00000E+00,
> 2.00000E+00, 5.00000E+00, 7.00000E+00, 5.00000E+00, 4.00000E+00,
> 3.00000E+00, 1.00000E+00, 1.00000E+00, 1.00000E+00, 2.00000E+00,
> 2.00000E+00, 3.00000E+00, 5.00000E+00, 1.00000E+00, 5.00000E+00,
> 1.00000E+00, 6.00000E+00, 6.00000E+00, 2.00000E+00, 2.00000E+00,
> 3.00000E+00, 3.00000E+00, 1.00000E+00, 3.00000E+00, 3.00000E+00,
> 4.00000E+00, 7.00000E+00, 5.00000E+00, 1.00000E+00, 1.00000E+00,
> 2.00000E+00, 1.00000E+00, 4.00000E+00, 4.00000E+00, 4.00000E+00,
> 2.00000E+00, 8.00000E+00, 7.00000E+00, 3.00000E+00, 5.00000E+00,
> 1.00000E+00, 6.00000E+00, 1.00000E+00, 2.00000E+00, 4.00000E+00,
> 1.00000E+00, 5.00000E+00, 3.00000E+00, 1.00000E+00, 4.00000E+00,
> 6.00000E+00, 3.00000E+00, 4.00000E+00, 7.00000E+00, 6.00000E+00,
> 1.00000E+00, 1.00000E+00, 8.00000E+00, 7.00000E+00, 6.00000E+00,
> 1.00000E+00, 4.00000E+00, 3.00000E+00, 2.00000E+00, 1.00000E+00,
> 2.00000E+00, 4.00000E+00, 1.00000E+00, 2.00000E+00, 2.00000E+00,
> 2.00000E+00, 1.00000E+00, 3.00000E+00, 2.00000E+00, 3.00000E+00,
> 4.00000E+00, 5.00000E+00, 5.00000E+00, 3.00000E+00, 5.00000E+00,
> 2.00000E+00, 6.00000E+00, 1.00000E+00, 5.00000E+00, 4.00000E+00,
> 4.00000E+00, 3.00000E+00, 5.00000E+00, 4.00000E+00, 1.00000E+00,
> 1.00000E+00, 2.00000E+00, 7.00000E+00, 4.00000E+00, 2.00000E+00,
> 5.00000E+00, 2.00000E+00, 6.00000E+00, 1.00000E+00, 6.00000E+00,
> 2.00000E+00, 3.00000E+00, 2.00000E+00, 3.00000E+00, 3.00000E+00,
> 4.00000E+00, 1.00000E+00, 1.00000E+00, 2.00000E+00, 3.00000E+00,
> 3.00000E+00, 7.00000E+00, 1.00000E+00, 2.00000E+00, 1.00000E+00,
> 5.00000E+00, 8.00000E+00, 4.00000E+00, 1.00000E+00, 8.00000E+00,
> 1.00000E+00, 5.00000E+00, 6.00000E+00, 3.00000E+00, 5.00000E+00,
> 4.00000E+00, 1.00000E+00, 3.00000E+00, 2.00000E+00, 5.00000E+00,
> 4.00000E+00, 3.00000E+00, 6.00000E+00, 1.00000E+00, 1.00000E+00,
> 7.00000E+00, 4.00000E+00, 2.00000E+00, 2.00000E+00, 4.00000E+00,
> 2.00000E+00, 1.00000E+00, 2.00000E+00, 5.00000E+00, 2.00000E+00,
> 3.00000E+00, 7.00000E+00, 2.00000E+00, 1.00000E+00, 1.00000E+00,
> 3.00000E+00, 6.00000E+00, 3.00000E+00), .Dim=c(3, 144)), S=3.00000E+00,
> Q=1.44000E+02, N=9.00000E+00)
>
> ##################################################################
>
> Which is my data from files g.txt and q.txt - I go looking for a missing
> collection operator c but cannot find it anywhere, if anyone has a clue what
> I could do to get past this point, I would be so grateful!
>
> Best,
> N
>
>
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/R2WinBUGS-expected-collection-operator-c-error-tp4688032.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>




More information about the R-help mailing list