2

I need to load some data into WinBugs from Excel and for some reason, Winbugs doesn't recognize it. There are many things I have tried (all of which are listed below) and none of these work.

  1. I tried to copy from Excel and 'Paste Special' as 'Plain Text' into WinBugs. I added [] after every variable and even 'END' at the end. The error message came up as follows:

    Sorry something went wrong in procedure LoadNumeric Data in module BugRectData

  2. I copied and pasted into notepad, added [] after every variable and even 'END' at the end again and then removed all the space between the lines, and only one space between each data. When I dragged it into Winbugs, it dispersed into double space between the lines and large gaps between the data and the error message came up (when trying to load the data):

    Sorry something went wrong in procedure LoadNumeric Data in module BugRectData

  3. The last thing I did was to open the .txt file into Winbugs and it became all jumbled and when I tried to load the data, instead it highlighted some data such as NA2.0 that should have been NA 2.0 and said it "expected a number or an NA or END". After correcting these mistakes, the data seemed fine until the end where it said 'END' and it said the same thing only highlighting the E on the END.

If anyone could give any insight I would be most grateful.

Community
  • 1
  • 1
Exodia16
  • 177
  • 2
  • 6
  • 14

2 Answers2

2

It would be easier to answer if you had included part of your dataset, as you have included it in the Winbugs compound document. As stated in the Winbugs manual (http://www.mrc-bsu.cam.ac.uk/bugs/winbugs/manual14.pdf) data can be entered in S-plus format or in rectangular format. Rectangular format has the form:

Y[] x[]
5 4.1
3 2.1
4 3.5
END 

S-plus format (as an example):

list(Y=c(5,3,4),x=c(4.1,2.1,3.5))

Have you tried these specifically and with the full correct syntax? In rectangular format the arrays must be of equal length, and all must have a heading.

I wouldn't do direct copy/paste from excel to winbugs since all kinds of strange formatting can come along. Try to copy the data to .txt first or save as a tab spaced .csv. Check that the file looks ok before you insert it to Winbugs, using e.g 'Paste special' and plain text.

fileunderwater
  • 1,125
  • 2
  • 12
  • 31
1
  1. From: ↨here download the file "writeDatafileR.txt". For details here's a link!

  2. Write in R: source("writeDatafileR.txt")

  3. Given that df is a data.frame, type in the R command prompt: writeDatafileR(df," df.txt")

  4. This will make a file "df.txt" with the data that we may copy and paste in our Winbugs code.