Blanchard, Suzette
2008-Apr-08 02:30 UTC
[R] Error: expected the collection operator c error pos 98 (error on line 1)
Greetings, I implemented BRugs to run the EWOC model with a cohort size N=1. I output the simulation data using bugsdata(data), where data is the following list.> data$Dose [1] 140 $Y [1] 0 bugsdata(data) puts out the file data.txt as follows. list(Dose=1.40000E+02, Y=0.00000E+00) after I type the following line modelData("data.txt") # read data file I get the ERROR: expected the collection operator c error pos 98 (error on line 1) If I rewrite the file list(Dose=c(1.40000E+02), c(Y=0.00000E+00)) it runs fine. Can you suggest a way to get the output dataset to automatically put the c( ) on the data when the sample size is 1? Thank you, Suzette Suzette Blanchard, Ph.D. Assistant Professor, Dept. of Biostatistics City of Hope 1500 East Duarte Rd Duarte, CA 91010-3000 ph: (626) 256-4673 ext:64446 sblanchard@coh.org --------------------------------------------------------------------- SECURITY/CONFIDENTIALITY WARNING: \ This message an...{{dropped:24}}
Uwe Ligges
2008-Apr-10 10:13 UTC
[R] Error: expected the collection operator c error pos 98 (error on line 1)
Blanchard, Suzette wrote:> Greetings, > > > > I implemented BRugs to run the EWOC model with a cohort size N=1. I output the simulation data using bugsdata(data), where data is the following list. > > > >> data > > $Dose > > [1] 140 > > > > $Y > > [1] 0 > > > > bugsdata(data) puts out the file data.txt as follows. > > > > list(Dose=1.40000E+02, Y=0.00000E+00) > > > > after I type the following line > > modelData("data.txt") # read data file > > > > I get the ERROR: > > expected the collection operator c error pos 98 (error on line 1) > > > > If I rewrite the file > > > > list(Dose=c(1.40000E+02), c(Y=0.00000E+00)) > > > > it runs fine. Can you suggest a way to get the output dataset to automatically put the > > c( ) on the data when the sample size is 1?Hmmm, I will take a look how to implement it. I guess you have modeled Y to be a vector by indexing with brackets in your BUGS model? It works for me if I use Y without index brackets in a BUGS model file. Best wishes, Uwe> > > Thank you, > > Suzette > > > > Suzette Blanchard, Ph.D. > Assistant Professor, Dept. of Biostatistics > City of Hope > 1500 East Duarte Rd > Duarte, CA 91010-3000 > ph: (626) 256-4673 ext:64446 > sblanchard at coh.org > > > > --------------------------------------------------------------------- > > SECURITY/CONFIDENTIALITY WARNING: \ This message an...{{dropped:24}} > > ______________________________________________ > 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.
Uwe Ligges
2008-Apr-10 10:27 UTC
[R] Error: expected the collection operator c error pos 98 (error on line 1)
Quick inspection shows that we cannot do anything. In BUGS, Y indicates a scalar and Y[] indicates a vector. For scalar Y, you need Y=0.00000E+00 in your data file, but for vector Y[], you need Y=c(0.00000E+00) in your data file. This means you need to know what Y is in the model and I do not see any API I can use to ask the BRugs.dll what Y actually is. So question redirected to Andrew Thomas (in CC). Best wishes, Uwe Uwe Ligges wrote:> > > Blanchard, Suzette wrote: >> Greetings, >> >> >> >> I implemented BRugs to run the EWOC model with a cohort size >> N=1. I output the simulation data using bugsdata(data), where data >> is the following list. >> >> >>> data >> >> $Dose >> >> [1] 140 >> >> >> >> $Y >> >> [1] 0 >> >> >> >> bugsdata(data) puts out the file data.txt as follows. >> >> >> >> list(Dose=1.40000E+02, Y=0.00000E+00) >> >> >> >> after I type the following line >> >> modelData("data.txt") # read data file >> >> >> >> I get the ERROR: >> expected the collection operator c error pos 98 (error on line 1) >> >> >> >> If I rewrite the file >> >> >> >> list(Dose=c(1.40000E+02), c(Y=0.00000E+00)) >> >> >> >> it runs fine. Can you suggest a way to get the output dataset to >> automatically put the >> >> c( ) on the data when the sample size is 1? > > Hmmm, I will take a look how to implement it. > > I guess you have modeled Y to be a vector by indexing with brackets in > your BUGS model? It works for me if I use Y without index brackets in a > BUGS model file.> Best wishes, > Uwe > > > >> >> >> Thank you, >> >> Suzette >> >> >> >> Suzette Blanchard, Ph.D. >> Assistant Professor, Dept. of Biostatistics >> City of Hope >> 1500 East Duarte Rd >> Duarte, CA 91010-3000 >> ph: (626) 256-4673 ext:64446 >> sblanchard at coh.org >> >> >> >> --------------------------------------------------------------------- >> >> SECURITY/CONFIDENTIALITY WARNING: \ This message an...{{dropped:24}} >> >> ______________________________________________ >> 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. >