From: <li...@us...> - 2007-09-17 08:57:57
|
Revision: 63 http://bugs-r.svn.sourceforge.net/bugs-r/?rev=63&view=rev Author: ligges Date: 2007-09-17 01:57:59 -0700 (Mon, 17 Sep 2007) Log Message: ----------- allow argument modelFile to be a function that contains a BUGS model Modified Paths: -------------- trunk/BRugs/R/BRugsFit.R trunk/BRugs/man/BRugsFit.Rd Modified: trunk/BRugs/R/BRugsFit.R =================================================================== --- trunk/BRugs/R/BRugsFit.R 2007-09-16 17:33:18 UTC (rev 62) +++ trunk/BRugs/R/BRugsFit.R 2007-09-17 08:57:59 UTC (rev 63) @@ -13,6 +13,8 @@ setwd(working.directory) on.exit(setwd(savedWD), add = TRUE) } + if(is.function(modelFile)) + writeModel(modelFile, con = (modelFile <- tempfile("model"))) if(!file.exists(modelFile)) stop(modelFile, " does not exist") if(file.info(modelFile)$isdir) stop(modelFile, " is a directory, but a file is required") modelCheck(modelFile) Modified: trunk/BRugs/man/BRugsFit.Rd =================================================================== --- trunk/BRugs/man/BRugsFit.Rd 2007-09-16 17:33:18 UTC (rev 62) +++ trunk/BRugs/man/BRugsFit.Rd 2007-09-17 08:57:59 UTC (rev 63) @@ -9,7 +9,8 @@ BRugsVerbose = getOption("BRugsVerbose")) } \arguments{ -\item{modelFile}{File containing the model written in OpenBUGS code.} +\item{modelFile}{File containing the model written in OpenBUGS code, + an R function that contains a BUGS model that is written to a temporary model file (see \code{\link{tempfile}}) using \code{\link{writeModel}}.} \item{data}{Either a named list (names corresponding to variable names in the \code{modelFile}) of the data for the OpenBUGS model, \emph{or} a vector or list of the names of the data objects used by the model. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |