Monday, November 14, 2011

BRugs delayed in R version 2.14

[But you don't have to use BRugs any more. See this more recent blog post about JAGS.]

See updated post regarding BRugs and OpenBUGS.

The programming language R was recently updated to version 2.14. Unfortunately, BRugs is lagging behind, so it does not yet work with R 2.14. As of minutes ago, Uwe Ligges tells me, "I hope to get a new version to CRAN 'soon', i.e. within few weeks." Meanwhile, keep your older version of R installed if you want to use BRugs!

If you don't have a previous version of R, I happened to have the R 2.13 installation executable sitting on my computer, and I've made it available here: Just save it and then execute it to install R 2.13. Then, invoke R and type install.packages("BRugs") to install BRugs.

If you are using RStudio, and have R 2.14 installed in addition to R 2.13, you have to tell RStudio to use R 2.13. In RStudio, do this:
-> Options
-> R General
-> R Version "Change..." button
-> browse to something like C:\Program Files\R\R-2.13.0
Click apply/okay.
Then quit RStudio and restart it.


  1. A colleague took your week-long workshop over the summer and came back to work and gave a presentation. I'm trying to get the software installed on my laptop so that I can explore the analyses and learn more about the approach. But I'm having problems. The instructions here: aren't working for me. Would it be too much trouble to provide an updated, step-by-step list of instructions that will take me (and other newbies) through the whole procedure? Thanks!

  2. For step-by-step instructions, go to this recent workshop page and scroll down to the bottom: But also heed the current blog post that R 2.14 doesn't yet have BRugs updated! Therefore, when installing R (step 2 of the linked instructions), you may need to grab R 2.13 from the link in the blog post instead of using R 2.14 from the R web site.

  3. Thanks - I think I've gotten further, but not 100% there yet. I downloaded R 2.13 from your blog post and followed the rest of the instructions from your workshop page. The test file runs, but when I tried the ANOVA example with McDonald data (the one my colleague showed us), it doesn't work. This is what I get:

    > source("C:\\Program Files\\R\\R-2.13.0\\ANOVAonewayBRugs.R")
    Error in file(con, "w") : cannot open the connection
    In addition: Warning message:
    In file(con, "w") : cannot open file 'model.txt': Permission denied

    Any thoughts?

    Thanks for your help - I really appreciate it! :)

  4. I suspect that you don't have R's working directory set to the folder in which all the programs reside. If you're using R's built-in editor, look under the "File" menu and select "Change Dir...". Then navigate to the folder in which the programs reside and select it. Then try running again. Hopefully that solves the problem.

  5. Sadly, that is not it. I do have the directory set to the directory with the files. (Sorry, I should have mentioned that.) Everything is in C:/Program Files/R/R-2.13.0. Does it have to be a particular folder? (I did try again, just to be sure. It doesn't change anything.) Any other thoughts? (I can't find the file model.txt - should it already exist in that directory?)

  6. Put the programs in your own user folder somewhere in your own personal tree of folders, and change R's working directory to that folder. I believe that C:/Program Files/... is protected and not valid for ordinary user files.

  7. You solved it! Thank you SO much! One last question and then I promise that I'll quit pestering you with boring software installation stuff and only check back in if I have an interesting statistical question. ;)

    Should it be safe for me to now download R Studio? Is there anything in particular that I should watch for when I do this?

    Thanks again! I've got a ton of data just waiting to have population parameters estimated! I can't wait to get started. :)

  8. R Studio should install seamlessly at this point, if you have only installed R 2.13 and are running 32-bit Windows.

    If you also installed R 2.14, and/or you have a 64-bit operating system, the R Studio will default to 2.14 or 64-bit R and you may have to tell R Studio to use 32-bit version 2.13: Go to "Tools" -> "Options" -> "R General" and in the top line ("R version") click the Change button.

    Happy estimating!

  9. It worked. :)
    Thanks again! :)
    And now, the fun begins!