0

I have looked through the help files and have not found my answer.

I have a .dat file which lists variables and contains their data.

in the 'var.dat' file the first lines look like this: (I've cut it down for ease of viewing)

"N" <- 55872
"Nc" <- 49
"g0" <- c(0, 0)
"G0" <- structure(c(0.1, 0, 0, 0.1), .Dim = c(2, 2))
"group" <- c(1, 1, 1, 1, 1, 1, 1, 1, 1)
"X" <- structure(c(1, 1, 1, 1, 1, 1, 1)
"y" <- c(10, 10, 10, 9, 4, 10, 10)
"var1" <- c(8.7, 3.7, 3.6, 3.1, 8.9)
"Tau" <- structure(c(0.1, 0, 0, 0, 0.1, 0, 0, 0, 0.1), .Dim = c(3, 3))

Here is my question.

in the following line of code I need to reference the var.dat file.

How is this code calling the file? Where do I need to save it so the code can access the file= function? Do I need to load it first?

mod.dat<- cat(dump.format(list(
      N = nrow(X), Nc = length(group), g0 = c(0,0), G0 = 
      diag(2)*.1, group=grp, X=X, y = dat$dv, var=var[,2], Tau = 
      diag(3)*.1)), file="var.dat")

Thanks.

NikFord
  • 1
  • 1
  • 1
    `dump.format`? I don't have that one in my base R. – Rich Scriven Jun 29 '17 at 01:40
  • `bayescount::dump.format` maybe? You probably have to provide information about all the packages you've loaded from a fresh R session to make this code run. As Rich notes, this isn't a standard piece of code. – thelatemail Jun 29 '17 at 01:46
  • I use it all the time. it's from package 'runjags' i have never used it with file='' though.... – NikFord Jun 29 '17 at 01:57
  • @RichScriven it's in package 'runjags' – NikFord Jun 29 '17 at 02:03
  • @thelatemail failed.jags() returns it is not able to fine the variables in that file. I will keep trying. Is there another way to get the file in the console? – NikFord Jun 29 '17 at 02:04
  • The `var.dat` file just looks like a bunch of R objects being defined. You could probably just use `?source` to read it in. – thelatemail Jun 29 '17 at 02:06
  • @thelatemail thanks for the suggestion. I tried source() , and in the code: `code` Tau = diag(3)*.1)), source=nf.file) and a few others.... for far still retuning mod.dat object as NULL – NikFord Jun 29 '17 at 04:44

0 Answers0