From: <li...@us...> - 2012-07-23 17:47:56
|
Revision: 254 http://bugs-r.svn.sourceforge.net/bugs-r/?rev=254&view=rev Author: ligges Date: 2012-07-23 17:47:46 +0000 (Mon, 23 Jul 2012) Log Message: ----------- make BRugs OpenBUGS 3.2.2 compatible (and drop back compatibility) and some more fixes for R >= 2.15.1; bump version number Modified Paths: -------------- trunk/BRugs/DESCRIPTION trunk/BRugs/NEWS trunk/BRugs/R/info.modules.R trunk/BRugs/R/info.node.R trunk/BRugs/R/info.updaters.R trunk/BRugs/R/model.setWD.R trunk/BRugs/tests/BRugs.Rout.save trunk/BRugs/tests/examples.Rout.save trunk/BRugs/tests/functions.Rout.save Modified: trunk/BRugs/DESCRIPTION =================================================================== --- trunk/BRugs/DESCRIPTION 2012-07-12 02:22:12 UTC (rev 253) +++ trunk/BRugs/DESCRIPTION 2012-07-23 17:47:46 UTC (rev 254) @@ -1,12 +1,12 @@ Package: BRugs Title: R interface to the OpenBUGS MCMC software -Version: 0.7-5 -Date: 2012-01-06 +Version: 0.8-0 +Date: 2012-07-23 Author: OpenBUGS was developed by Andrew Thomas, Dave Lunn, David Spiegelhalter and Nicky Best. R interface developed by Uwe Ligges, Sibylle Sturtz, Andrew Gelman, Gregor Gorjanc and Chris Jackson. Linux port and most recent developments by Chris Jackson. Description: Fully-interactive R interface to the OpenBUGS software for Bayesian analysis using MCMC sampling. Runs natively and stably in 32-bit R under Windows. Versions running on Linux and on 64-bit R under Windows are in "beta" status and less efficient. Maintainer: Uwe Ligges <li...@st...> Depends: R (>= 2.11.0), coda Imports: utils, coda -SystemRequirements: OpenBUGS (>= 3.2.1), hence Windows or Linux +SystemRequirements: OpenBUGS (>= 3.2.2), hence Windows or Linux License: GPL-2 URL: http://www.openbugs.info/ Modified: trunk/BRugs/NEWS =================================================================== --- trunk/BRugs/NEWS 2012-07-12 02:22:12 UTC (rev 253) +++ trunk/BRugs/NEWS 2012-07-23 17:47:46 UTC (rev 254) @@ -1,5 +1,20 @@ Changes to BRugs: ===================== + +Version 0.8.0 (23 July 2012) +------------- +BRugs now works with an existing installation of OpenBUGS (>?)= 3.2.2. + +modelSetWD is exported from the NAMESPACE + +bugfixed to find examples on various Linux installations + + +Version 0.7.4, 0.7.5 +-------------------- +bugfix releases + + Version 0.7.3 (02 January 2012) ------------- BRugs now supports 64-bit R on Windows, using the same helper program Modified: trunk/BRugs/R/info.modules.R =================================================================== --- trunk/BRugs/R/info.modules.R 2012-07-12 02:22:12 UTC (rev 253) +++ trunk/BRugs/R/info.modules.R 2012-07-23 17:47:46 UTC (rev 254) @@ -5,7 +5,7 @@ command <- "BugsEmbed.Modules" .CmdInterpreter(command) buffer <- file.path(tempdir(), "buffer.txt") - result <- read.fwf(buffer, c(50, 12, 12, 12, 12, 10), skip = 1, as.is=TRUE) + result <- read.table(buffer, skip = 1, as.is=TRUE, sep="\t")[,-1] for(i in c(1,4,5,6)) result[,i] <- gsub(" ", "", result[,i]) names(result) <- c("Module", "Clients", "Version", "Maintainer", "Compiled", "Loaded") Modified: trunk/BRugs/R/info.node.R =================================================================== --- trunk/BRugs/R/info.node.R 2012-07-12 02:22:12 UTC (rev 253) +++ trunk/BRugs/R/info.node.R 2012-07-23 17:47:46 UTC (rev 254) @@ -1,42 +1,42 @@ -"infoNodeValues" <- -function(nodeLabel) -# Get current value of node -{ - nodeLabel <- as.character(nodeLabel) - out <- .OpenBUGS(c("BugsRobjects.SetVariable", "BugsRobjects.GetSize"), - c("CharArray","Integer"), - list(nodeLabel, NA)) - nodeSize <- out[[2]] - if(nodeSize == -1) - stop(nodeLabel, " is not a node in BUGS model") - numChains <- getNumChains() - out <- .OpenBUGS(c("BugsRobjects.SetVariable", "BugsRobjects.GetValues"), - c("CharArray","RealArray"), - list(nodeLabel, double(nodeSize*numChains))) - values <- matrix(out[[2]], nrow=nodeSize, ncol=numChains) - values -} - -infoNodeMethods <- function(nodeLabel) -{ - nodeName <- sQuote(nodeLabel) - command <- paste("BugsEmbed.SetNode(",nodeName,"); BugsEmbed.Methods"); - .CmdInterpreter(command) - buffer <- file.path(tempdir(), "buffer.txt") - result <- read.fwf(buffer, c(25, 25, 25, 25), skip = 1, as.is=TRUE, col.names=c("Node","Type", "Size", "Depth")) - for (i in 1:2) - result[,i] <- gsub(" ", "", result[,i]) - result -} - -infoNodeTypes <- function(nodeLabel) -{ - nodeName <- sQuote(nodeLabel) - command <- paste("BugsEmbed.SetNode(",nodeName,"); BugsEmbed.Types"); - .CmdInterpreter(command) - buffer <- file.path(tempdir(), "buffer.txt") - result <- read.fwf(buffer, c(25, 25), skip = 1, as.is=TRUE, col.names=c("Node","Type")) - for (i in 1:2) - result[,i] <- gsub(" ", "", result[,i]) - result -} +"infoNodeValues" <- +function(nodeLabel) +# Get current value of node +{ + nodeLabel <- as.character(nodeLabel) + out <- .OpenBUGS(c("BugsRobjects.SetVariable", "BugsRobjects.GetSize"), + c("CharArray","Integer"), + list(nodeLabel, NA)) + nodeSize <- out[[2]] + if(nodeSize == -1) + stop(nodeLabel, " is not a node in BUGS model") + numChains <- getNumChains() + out <- .OpenBUGS(c("BugsRobjects.SetVariable", "BugsRobjects.GetValues"), + c("CharArray","RealArray"), + list(nodeLabel, double(nodeSize*numChains))) + values <- matrix(out[[2]], nrow=nodeSize, ncol=numChains) + values +} + +infoNodeMethods <- function(nodeLabel) +{ + nodeName <- sQuote(nodeLabel) + command <- paste("BugsEmbed.SetNode(",nodeName,"); BugsEmbed.Methods"); + .CmdInterpreter(command) + buffer <- file.path(tempdir(), "buffer.txt") + result <- read.table(buffer, sep="\t", skip = 1, as.is=TRUE, col.names=c("empty", "Node", "Type", "Size", "Depth"))[,-1] + for (i in 1:2) + result[,i] <- gsub(" ", "", result[,i]) + result +} + +infoNodeTypes <- function(nodeLabel) +{ + nodeName <- sQuote(nodeLabel) + command <- paste("BugsEmbed.SetNode(",nodeName,"); BugsEmbed.Types"); + .CmdInterpreter(command) + buffer <- file.path(tempdir(), "buffer.txt") + result <- read.table(buffer, sep="\t", skip = 1, as.is=TRUE, col.names=c("empty", "Node", "Type"))[,-1] + for (i in 1:2) + result[,i] <- gsub(" ", "", result[,i]) + result +} Modified: trunk/BRugs/R/info.updaters.R =================================================================== --- trunk/BRugs/R/info.updaters.R 2012-07-12 02:22:12 UTC (rev 253) +++ trunk/BRugs/R/info.updaters.R 2012-07-23 17:47:46 UTC (rev 254) @@ -8,8 +8,8 @@ if (readLines(buffer)[1]=="BugsCmds:NotCompiled") stop("Model not compiled") buffer <- file.path(tempdir(), "Updater types.txt") - result <- read.fwf(buffer, c(25, 50, 10, 10), skip = 1, as.is=TRUE, - row.names=1, col.names=c("Node","Type", "Size","Depth")) + result <- read.table(buffer, sep="\t", skip=1, as.is=TRUE, + row.names=2, col.names=c("empty", "Node", "Type", "Size", "Depth"))[,-1] ## strip leading and trailing spaces for (i in 1:2) { result[,i] <- gsub("^ +", "\\1", result[,i]) @@ -30,8 +30,8 @@ if (readLines(buffer)[1]=="BugsCmds:NotCompiled") stop("Model not compiled") buffer <- file.path(tempdir(), "Updater types.txt") - result <- read.fwf(buffer, c(25, 50, 10, 10), skip = 1, as.is=TRUE, - row.names=1, col.names=c("Node","Type", "Size","Depth")) + result <- read.table(buffer, sep="\t", skip=1, as.is=TRUE, + row.names=2, col.names=c("empty", "Node", "Type", "Size", "Depth"))[,-1] ## strip leading and trailing spaces for (i in 1:2) { result[,i] <- gsub("^ +", "\\1", result[,i]) Modified: trunk/BRugs/R/model.setWD.R =================================================================== --- trunk/BRugs/R/model.setWD.R 2012-07-12 02:22:12 UTC (rev 253) +++ trunk/BRugs/R/model.setWD.R 2012-07-23 17:47:46 UTC (rev 254) @@ -1,3 +1,3 @@ ## Simple alias to mimic the OpenBUGS script command -"modelSetWD" <- setwd +"modelSetWD" <- function(dir) setwd(dir) Modified: trunk/BRugs/tests/BRugs.Rout.save =================================================================== --- trunk/BRugs/tests/BRugs.Rout.save 2012-07-12 02:22:12 UTC (rev 253) +++ trunk/BRugs/tests/BRugs.Rout.save 2012-07-23 17:47:46 UTC (rev 254) @@ -80,7 +80,7 @@ + } Loading required package: coda Loading required package: lattice -Welcome to BRugs connected to OpenBUGS version 3.2.1 +Welcome to BRugs connected to OpenBUGS version 3.2.2 model is syntactically correct data loaded model compiled Modified: trunk/BRugs/tests/examples.Rout.save =================================================================== --- trunk/BRugs/tests/examples.Rout.save 2012-07-12 02:22:12 UTC (rev 253) +++ trunk/BRugs/tests/examples.Rout.save 2012-07-23 17:47:46 UTC (rev 254) @@ -68,7 +68,7 @@ + } Loading required package: coda Loading required package: lattice -Welcome to BRugs connected to OpenBUGS version 3.2.1 +Welcome to BRugs connected to OpenBUGS version 3.2.2 model is syntactically correct data loaded model compiled @@ -89,7 +89,7 @@ model is initialized model is already initialized 5000 updates took 0 s -can not calculate deviance for this model +can not calculate DIC for this model monitor set for variable 'bronchitis' monitor set for variable 'either' monitor set for variable 'lung.cancer' @@ -128,7 +128,7 @@ model is initialized model is already initialized 5000 updates took 0 s -can not calculate deviance for this model +can not calculate DIC for this model monitor set for variable 'Sigma2' monitor set for variable 'rho' monitor set for variable 'tau' @@ -187,7 +187,7 @@ initial values loaded but chain contain uninitialized variables initial values generated, model initialized 5000 updates took 0 s -can not calculate deviance for this model +can not calculate DIC for this model monitor set for variable 'P' monitor set for variable 'lambda' monitor set for variable 'sigma' Modified: trunk/BRugs/tests/functions.Rout.save =================================================================== --- trunk/BRugs/tests/functions.Rout.save 2012-07-12 02:22:12 UTC (rev 253) +++ trunk/BRugs/tests/functions.Rout.save 2012-07-23 17:47:46 UTC (rev 254) @@ -151,7 +151,7 @@ + } Loading required package: coda Loading required package: lattice -Welcome to BRugs connected to OpenBUGS version 3.2.1 +Welcome to BRugs connected to OpenBUGS version 3.2.2 model is syntactically correct data loaded model compiled This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |