You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(11) |
Dec
(20) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
|
Feb
|
Mar
|
Apr
(7) |
May
(24) |
Jun
(15) |
Jul
(5) |
Aug
(21) |
Sep
(85) |
Oct
(9) |
Nov
|
Dec
|
2008 |
Jan
(15) |
Feb
(11) |
Mar
|
Apr
(2) |
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
(29) |
Oct
(47) |
Nov
(1) |
Dec
(1) |
2009 |
Jan
(8) |
Feb
(12) |
Mar
(14) |
Apr
(4) |
May
(1) |
Jun
|
Jul
(5) |
Aug
|
Sep
|
Oct
(11) |
Nov
(18) |
Dec
|
2010 |
Jan
|
Feb
|
Mar
(1) |
Apr
(3) |
May
(24) |
Jun
|
Jul
(1) |
Aug
(7) |
Sep
(5) |
Oct
(3) |
Nov
(4) |
Dec
|
2011 |
Jan
|
Feb
|
Mar
(13) |
Apr
(3) |
May
(2) |
Jun
|
Jul
(1) |
Aug
(24) |
Sep
(3) |
Oct
|
Nov
|
Dec
(29) |
2012 |
Jan
(5) |
Feb
(5) |
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
(3) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
(9) |
May
(1) |
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(1) |
Jun
|
Jul
(3) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(5) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Gregor G. <gre...@bf...> - 2007-06-11 12:40:53
|
Hi, I have looked at Dawn's change about "thinning" setup in R2WinBUGS and would like to summarize it here, because it was not really clear (at least to me) what the change for S-PLUS side was all about. Default behavior in R is now to create a BUGS script with the following BUGS commands for a run with 5000 iterations, 1000 burn-in and thinning interval 12 (showing only relevant parts): ---------------------------------------------------- BUGS script start # after model, inits, ... set burnin phase thin.updater (12) update (84) # set parameters to monitor update(334) coda() ------------------------------------------------------ BUGS script end Dawn has changed this in S-PLUS part to: ---------------------------------------------------- BUGS script start # after model, inits, ... set burnin phase update (1000) thin.updater (12) # set parameters to monitor update(4000) coda() ------------------------------------------------------ BUGS script end In my humble opinion this is better: - BUGS script is clearer - CODA files have indices that match iteration number This does not affect R2WinBUGS as it has only effect on produced CODA files. For example, reading CODA files into R from above runs, would after read.coda() give the following info: # Current implementation Iterations = 85:418 Thinning interval = 1 Number of chains = 1 Sample size per chain = 334 # Proposed implementation by Dawn Iterations = 1001:4985 Thinning interval = 12 Number of chains = 1 Sample size per chain = 333 Better, again! If there are no objections, I will commit this change. -------- Original Message -------- Date: Thu, 19 Apr 2007 18:39:50 -0400 From: Andrew Gelman <ge...@st...> G I don't actually understand the question! A Gregor Gorjanc wrote: > Hi, > > In my opinion Dawn's change make sense also for R side. Does anyone have > any objection for not porting this also to R side? > > Gregor > > -------- Original Message -------- > Subject: [Bugs-r-devel] SF.net SVN: bugs-r: [12] > trunk/R2WinBUGS/R/bugs.script.R > Date: Tue, 17 Apr 2007 07:21:52 -0700 > From: woo...@us... > To: bug...@li... > > Revision: 12 > http://svn.sourceforge.net/bugs-r/?rev=12&view=rev > Author: woodard_ > Date: 2007-04-17 07:21:52 -0700 (Tue, 17 Apr 2007) > > Log Message: > ----------- > In S-PLUS, the handling of the thinning is done differently than in R. > bin represents the number of iterations between saves, before thinning, > where in R it is the number of iterations between saves, after thinning. > This alternative handling of the thinning is done so that the resulting > samples have the correct iteration indexes in the output (coda) files. > Therefore, if the samples are read into S-PLUS using the coda package, > the thinning will be correctly labelled in the resulting mcmc object. > In R, the thinning is always labelled as 1, even if thinning was done. > > Modified Paths: > -------------- > trunk/R2WinBUGS/R/bugs.script.R > > Modified: trunk/R2WinBUGS/R/bugs.script.R > =================================================================== > --- trunk/R2WinBUGS/R/bugs.script.R 2007-04-16 11:21:38 UTC (rev 11) > +++ trunk/R2WinBUGS/R/bugs.script.R 2007-04-17 14:21:52 UTC (rev 12) > @@ -21,6 +21,24 @@ > initlist <- paste("inits (", 1:n.chains, ", '", inits, "')\n", sep="") > savelist <- paste("set (", parameters.to.save, ")\n", sep="") > redo <- ceiling((n.iter-n.burnin)/(n.thin*bin)) > + > + if (is.R()){ > + thinUpdateCommand <- paste("thin.updater (", n.thin, ")\n", > + "update (", ceiling(n.burnin/n.thin), ")\n", sep = "") > + } else{ > ... > + thinUpdateCommand <- paste("update (", n.burnin, ")\n", > + "thin.samples (", n.thin, ")\n", sep = "") > + bin = bin * n.thin > + } > + > cat( > "display ('log')\n", > "check ('", native2win(model), "')\n", > @@ -28,8 +46,7 @@ > "compile (", n.chains, ")\n", > if(is.inits) initlist, > "gen.inits()\n", > - "thin.updater (", n.thin, ")\n", > - "update (", ceiling(n.burnin/n.thin), ")\n", > + thinUpdateCommand, > savelist, > if(DIC) "dic.set()\n", > rep( > > > This was sent by the SourceForge.net collaborative development platform, > the world's largest Open Source development site. > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Bugs-r-devel mailing list > Bug...@li... > https://lists.sourceforge.net/lists/listinfo/bugs-r-devel > > -- Andrew Gelman Professor, Department of Statistics Professor, Department of Political Science Columbia University, New York ge...@st... www.stat.columbia.edu/~gelman Office hours spring 2006: to be announced Statistics department office: Social Work Bldg (Amsterdam Ave at 122 St), Room 1016 212-851-2142 Political Science department office: International Affairs Bldg (Amsterdam Ave at 118 St), Room 731 212-854-7075 Mailing address: 1255 Amsterdam Ave, Room 1016 Columbia University New York, NY 10027-5904 212-851-2142 (fax) 212-851-2164 -- Lep pozdrav / With regards, Gregor Gorjanc ---------------------------------------------------------------------- University of Ljubljana PhD student Biotechnical Faculty www: http://www.bfro.uni-lj.si/MR/ggorjan Zootechnical Department blog: http://ggorjan.blogspot.com Groblje 3 mail: gregor.gorjanc <at> bfro.uni-lj.si SI-1230 Domzale fax: +386 (0)1 72 17 888 Slovenia, Europe tel: +386 (0)1 72 17 861 ---------------------------------------------------------------------- |
From: Gregor G. <gre...@bf...> - 2007-06-11 12:22:27
|
Hi John, Sibylee forwarded me your mail, because I have been involved in Linux/UNIX part of R2WinBUGS. Sturtz, Sibylle wrote: > Gregor, > > as you are the R2WinBUGS wine expert: do you have any idea what might be John's problem? > > Sibylle > > -----Ursprüngliche Nachricht----- > Von: John P. Burkett [mailto:bu...@ur...] > Gesendet: Sonntag, 10. Juni 2007 17:46 > An: st...@st... > Betreff: R2WinBUGS, wine > > Dear Sibylle Sturtz: > > While attempting to use R2WinBUGS, I get the following error message: > > Error in regexpr(pattern, text, extended, fixed, useBytes) : > invalid argument > fixme:keyboard:RegisterHotKey (0x10024,13,0x00000002,3): stub > Error in file(file, "r") : unable to open connection Can you please issue traceback() after this error? I am bit lazy to search all the code in R2WinBUGS ;) ... > gentoo linux machines I am using R version 2.2.1 and wine version 0.9.29 > (the latest versions available through gentoo's portage system). When > WinBUGS is called from R, its screen indicates that it is release 3.0.0. Hmm, this must be OpenBUGS? I still had not yet time to port OpenBUGS commands to R2WinBUGS. With R2WinBUGS under Linux you must use WinBUGS 1.4 from http://www.mrc-bsu.cam.ac.uk/bugs/. I know that this is not documented anywhere, but I do think in this direction. Sorry. Anyway, you can work out all examples from Gelman and Hill book - I am not sure about all the details. Alternatively, you can try with rbugs package http://cran.r-project.org/src/contrib/Descriptions/rbugs.html Unfortunately, I can not comment on it. > The R command that precipitates the error messages is the following: > > radon.1 <- bugs (radon.data, radon.inits, radon.parameters, > "radon.1.bug", n.chains=3, n.iter=10, debug=TRUE, program="winbugs", > bugs.directory="/home/john/OpenBUGS", useWINE=TRUE, newWINE=TRUE, > WINEPATH=WINEPATH, WINE="/usr/bin/wine") > > This command opens a large WinBUGS screen and smaller Log screen, both > of which are empty. To check whether the command produced an object > called radon.1, I tried the command (suggested by Gelman and Hill) "plot > (radon.1)". The response was as follows: > > Error in plot(radon.1) : object "radon.1" not found Yes, since bugs() failed, there was no return value from it and plot() does not work. > The command sessionInfo() produces the following output: > R version 2.2.1, 2005-12-20, i686-pc-linux-gnu Btw. It is time to upgrade your R! -- Lep pozdrav / With regards, Gregor Gorjanc ---------------------------------------------------------------------- University of Ljubljana PhD student Biotechnical Faculty www: http://www.bfro.uni-lj.si/MR/ggorjan Zootechnical Department blog: http://ggorjan.blogspot.com Groblje 3 mail: gregor.gorjanc <at> bfro.uni-lj.si SI-1230 Domzale fax: +386 (0)1 72 17 888 Slovenia, Europe tel: +386 (0)1 72 17 861 ---------------------------------------------------------------------- |
From: Kurt H. <Kur...@wu...> - 2007-05-24 17:25:26
|
>>>>> Uwe Ligges writes: > Kurt, > R2WinBUGS_2.1-4 has just been uploaded to CRAN/incoming. Thanks, on CRAN now. Best -k |
From: Uwe L. <li...@st...> - 2007-05-24 11:33:24
|
Kurt, R2WinBUGS_2.1-4 has just been uploaded to CRAN/incoming. Thnaks, Uwe |
From: Uwe L. <li...@st...> - 2007-05-24 11:11:20
|
Dawn Woodard wrote: > I made one fix to the new codetools code, and fixed one bug in > replaceScientificNotation. R2WinBUGS is now working under S-PLUS. Great! I just made a release and uploaded to CRAN. Uwe > Thank you! > Dawn > > -----Original Message----- > From: Uwe Ligges [mailto:li...@st...] > Sent: Sunday, May 20, 2007 11:46 AM > To: Dawn Woodard > Cc: bug...@li... > Subject: Re: [Bugs-r-devel] Codetools and S-PLUS (was R2WinBUGS_2.1-3.tar.gz) > > Dawn, > > I have updated the vignette and added some tricks to make codetools calm > and make R2WinBUGS work under S-PLUS at the same time. Can you please > take a look whether it works for you? If so, I'll submit the next > release to CRAN. > > Best, > uwe > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Bugs-r-devel mailing list > Bug...@li... > https://lists.sourceforge.net/lists/listinfo/bugs-r-devel |
From: Dawn W. <dwo...@in...> - 2007-05-23 17:46:56
|
I made one fix to the new codetools code, and fixed one bug in replaceScientificNotation. R2WinBUGS is now working under S-PLUS. Thank you! Dawn -----Original Message----- From: Uwe Ligges [mailto:li...@st...]=20 Sent: Sunday, May 20, 2007 11:46 AM To: Dawn Woodard Cc: bug...@li... Subject: Re: [Bugs-r-devel] Codetools and S-PLUS (was = R2WinBUGS_2.1-3.tar.gz) Dawn, I have updated the vignette and added some tricks to make codetools calm = and make R2WinBUGS work under S-PLUS at the same time. Can you please=20 take a look whether it works for you? If so, I'll submit the next=20 release to CRAN. Best, uwe |
From: <woo...@us...> - 2007-05-23 17:44:28
|
Revision: 22 http://svn.sourceforge.net/bugs-r/?rev=22&view=rev Author: woodard_ Date: 2007-05-23 10:44:29 -0700 (Wed, 23 May 2007) Log Message: ----------- Fixed a bug in S-PLUS code (function replaceScientificNotation) Modified Paths: -------------- trunk/R2WinBUGS/R/write.model.R Modified: trunk/R2WinBUGS/R/write.model.R =================================================================== --- trunk/R2WinBUGS/R/write.model.R 2007-05-23 16:29:15 UTC (rev 21) +++ trunk/R2WinBUGS/R/write.model.R 2007-05-23 17:44:29 UTC (rev 22) @@ -40,7 +40,7 @@ ## Then, handle the negative exponents ## Find the first instance - sciNoteLoc <- regexpr("[0-9]*.{0,1}[0-9]*e\\-0[0-9]{2}", text) + sciNoteLoc <- regexpr("[0-9]*\\.{0,1}[0-9]*e\\-0[0-9]{2}", text) ## For every instance, replace the number while(sciNoteLoc > -1){ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <woo...@us...> - 2007-05-23 16:29:14
|
Revision: 21 http://svn.sourceforge.net/bugs-r/?rev=21&view=rev Author: woodard_ Date: 2007-05-23 09:29:15 -0700 (Wed, 23 May 2007) Log Message: ----------- Bug fix in S-PLUS: the syntax x <- y <- z is not allowed in S-PLUS, and was replaced by y <- z x <- y Modified Paths: -------------- trunk/R2WinBUGS/R/bugs.data.R Modified: trunk/R2WinBUGS/R/bugs.data.R =================================================================== --- trunk/R2WinBUGS/R/bugs.data.R 2007-05-20 15:45:39 UTC (rev 20) +++ trunk/R2WinBUGS/R/bugs.data.R 2007-05-23 16:29:15 UTC (rev 21) @@ -26,8 +26,9 @@ if(is.R()){ ## need some fake functions for codetools - "writeDatafileS4" <- toSingleS4 <- function(...) - stop("This function is not intended to be called in R!") + toSingleS4 <- function(...) + stop("This function is not intended to be called in R!") + "writeDatafileS4" <- toSingleS4 } else { ### The rest of this file is for S-PLUS only... This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Uwe L. <li...@st...> - 2007-05-20 15:48:11
|
Dawn, I have updated the vignette and added some tricks to make codetools calm and make R2WinBUGS work under S-PLUS at the same time. Can you please take a look whether it works for you? If so, I'll submit the next release to CRAN. Best, uwe Dawn Woodard wrote: > The documentation for the function bugs in R2WinBUGS.pdf has not been updated > to reflect the changes in the new release. > > Dawn > > -----Original Message----- > From: bug...@li... > [mailto:bug...@li...] On Behalf Of Uwe Ligges > Sent: Monday, May 14, 2007 4:31 AM > To: gre...@bf... > Cc: bug...@li... > Subject: Re: [Bugs-r-devel] Codetools and S-PLUS (was R2WinBUGS_2.1-3.tar.gz) > > > > Gregor Gorjanc wrote: >> Uwe Ligges wrote: >> ... >>>> You mean that package R2WinBUGS would hold definitions for S-PLUS >>>> specific functions? >>> It already does hold S-PLUS specific functions, thanks to Dawn. But this >>> leads to warnings in the R checks on CRAN, because codetools does not >>> know that code in if(!is.R()){HERE} should not be inspected. The >>> above idea is some dirty trick to calm codetools down ... >> Aha. Now I get it. Your solution is possible. I guess that there will be >> more packages with the same problem. Maybe you could ask maintainer of >> codetools about a more general approach? >> >> Gregor > > Good idea, I'll contact Luke. > > Uwe > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Bugs-r-devel mailing list > Bug...@li... > https://lists.sourceforge.net/lists/listinfo/bugs-r-devel > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Bugs-r-devel mailing list > Bug...@li... > https://lists.sourceforge.net/lists/listinfo/bugs-r-devel |
From: <li...@us...> - 2007-05-20 15:45:37
|
Revision: 20 http://svn.sourceforge.net/bugs-r/?rev=20&view=rev Author: ligges Date: 2007-05-20 08:45:39 -0700 (Sun, 20 May 2007) Log Message: ----------- Reverted some former changes: - Added some tricks (defining no-op-functions) to make codetools calm. - we do depend on coda now and we are importing parts of its Namespace now, in order to make codetools calm (S-PLUS does not like the "::" operator). Modified Paths: -------------- trunk/R2WinBUGS/Changes trunk/R2WinBUGS/DESCRIPTION trunk/R2WinBUGS/NAMESPACE trunk/R2WinBUGS/R/attach.all.R trunk/R2WinBUGS/R/bugs.data.R trunk/R2WinBUGS/R/read.bugs.R Modified: trunk/R2WinBUGS/Changes =================================================================== --- trunk/R2WinBUGS/Changes 2007-05-20 15:42:40 UTC (rev 19) +++ trunk/R2WinBUGS/Changes 2007-05-20 15:45:39 UTC (rev 20) @@ -74,3 +74,7 @@ - Ported to S-PLUS by Insightful Corp. - some fixes for codetools checks +Update 2.1-4 (20 May 2007): +- Depending on coda now (Namespace issues) +- some more fixes for codetools checks +- Vignette has been updated Modified: trunk/R2WinBUGS/DESCRIPTION =================================================================== --- trunk/R2WinBUGS/DESCRIPTION 2007-05-20 15:42:40 UTC (rev 19) +++ trunk/R2WinBUGS/DESCRIPTION 2007-05-20 15:45:39 UTC (rev 20) @@ -1,7 +1,7 @@ Package: R2WinBUGS Title: Running WinBUGS and OpenBUGS from R / S-PLUS -Date: 2007-05-13 -Version: 2.1-3 +Date: 2007-05-20 +Version: 2.1-4 Author: originally written by Andrew Gelman <ge...@st...>; changes and packaged by Sibylle Sturtz <st...@st...> and Uwe Ligges <li...@st...>. @@ -13,8 +13,8 @@ convergence in a table and graph, and save the simulations in arrays for easy access in R / S-PLUS. In S-PLUS, the openbugs functionality and the windows emulation functionality is not yet available. -Depends: R (>= 2.4.0) -Suggests: coda (>= 0.9-0), BRugs (>= 0.3-0) +Depends: R (>= 2.4.0), coda (>= 0.9-0) +Suggests: BRugs (>= 0.3-0) SystemRequirements: WinBUGS 1.4 URL: http://www.stat.columbia.edu/~gelman/bugsR/ Maintainer: Sibylle Sturtz <st...@st...> Modified: trunk/R2WinBUGS/NAMESPACE =================================================================== --- trunk/R2WinBUGS/NAMESPACE 2007-05-20 15:42:40 UTC (rev 19) +++ trunk/R2WinBUGS/NAMESPACE 2007-05-20 15:45:39 UTC (rev 20) @@ -1,3 +1,5 @@ +importFrom(coda, mcmc.list, read.coda) + export(bugs, attach.all, detach.all, @@ -12,3 +14,4 @@ S3method(print, bugs) S3method(plot, bugs) + Modified: trunk/R2WinBUGS/R/attach.all.R =================================================================== --- trunk/R2WinBUGS/R/attach.all.R 2007-05-20 15:42:40 UTC (rev 19) +++ trunk/R2WinBUGS/R/attach.all.R 2007-05-20 15:45:39 UTC (rev 20) @@ -18,6 +18,9 @@ if(overwrite) remove(list=rem, envir=.GlobalEnv) attach(x, name=name) } else { + ## next line is a dirty trick for R'd codetools check in R-2.5.0 + ## (should be removed after codetoold have been improved): + attach.default <- get("attach.default") attach.default(x, name = name) } } Modified: trunk/R2WinBUGS/R/bugs.data.R =================================================================== --- trunk/R2WinBUGS/R/bugs.data.R 2007-05-20 15:42:40 UTC (rev 19) +++ trunk/R2WinBUGS/R/bugs.data.R 2007-05-20 15:45:39 UTC (rev 20) @@ -24,6 +24,15 @@ } +if(is.R()){ + ## need some fake functions for codetools + "writeDatafileS4" <- toSingleS4 <- function(...) + stop("This function is not intended to be called in R!") +} else { + +### The rest of this file is for S-PLUS only... + + "writeDatafileS4" <- # # Writes to file "towhere" text defining a list containing "DATA" in a form compatable with WinBUGS. @@ -224,3 +233,5 @@ } x } + +} Modified: trunk/R2WinBUGS/R/read.bugs.R =================================================================== --- trunk/R2WinBUGS/R/read.bugs.R 2007-05-20 15:42:40 UTC (rev 19) +++ trunk/R2WinBUGS/R/read.bugs.R 2007-05-20 15:45:39 UTC (rev 20) @@ -1,13 +1,7 @@ read.bugs <- function(codafiles, ...){ - if(!require(coda)) + if(!is.R() && !require("coda")) stop("package 'coda' is required to use this function") - if (is.R()){ - coda::mcmc.list(lapply(codafiles, coda::read.coda, - index.file = file.path(dirname(codafiles[1]), "codaIndex.txt"), - ...)) - }else{ - mcmc.list(lapply(codafiles, read.coda, - index.file = file.path(dirname(codafiles[1]), "codaIndex.txt"), - ...)) - } + mcmc.list(lapply(codafiles, read.coda, + index.file = file.path(dirname(codafiles[1]), "codaIndex.txt"), + ...)) } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <li...@us...> - 2007-05-20 15:42:50
|
Revision: 19 http://svn.sourceforge.net/bugs-r/?rev=19&view=rev Author: ligges Date: 2007-05-20 08:42:40 -0700 (Sun, 20 May 2007) Log Message: ----------- - bugs.tex updated according to bugs.Rd - RdRW.sty updated according to Rd.sty in new releases of R - Z.cls updated in order to fit to RdRW.sty - R2WinBUGS.Rnw updated to say that we differ from original paper now - new R2WinBUGS.pdf generated Modified Paths: -------------- trunk/R2WinBUGS/inst/doc/R2WinBUGS.Rnw trunk/R2WinBUGS/inst/doc/R2WinBUGS.pdf trunk/R2WinBUGS/inst/doc/RdRW.sty trunk/R2WinBUGS/inst/doc/Z.cls trunk/R2WinBUGS/inst/doc/bugs.tex Modified: trunk/R2WinBUGS/inst/doc/R2WinBUGS.Rnw =================================================================== --- trunk/R2WinBUGS/inst/doc/R2WinBUGS.Rnw 2007-05-15 14:57:29 UTC (rev 18) +++ trunk/R2WinBUGS/inst/doc/R2WinBUGS.Rnw 2007-05-20 15:42:40 UTC (rev 19) @@ -29,11 +29,12 @@ \Plainkeywords{R, WinBUGS, interface, MCMC} \begin{document} -This paper has been published by the Journal of Statistical Software:\\ +An earlier version of this vignette has been published by the Journal of Statistical Software:\\ Sturtz S, Ligges U, Gelman A (2005): ``\RW{}: A Package for Running \WinBUGS{} from \R{}.'' {\em Journal of Statistical Software}, 12(3), 1--16. + \section{Introduction}\label{Introduction} The usage of Markov chain Monte Carlo (MCMC) methods became very popular within the last decade. \WinBUGS{} \citep[\textbf{B}ayesian inference \textbf{U}sing \textbf{G}ibbs \textbf{S}ampling, ][] Modified: trunk/R2WinBUGS/inst/doc/R2WinBUGS.pdf =================================================================== --- trunk/R2WinBUGS/inst/doc/R2WinBUGS.pdf 2007-05-15 14:57:29 UTC (rev 18) +++ trunk/R2WinBUGS/inst/doc/R2WinBUGS.pdf 2007-05-20 15:42:40 UTC (rev 19) @@ -1,4 +1,5 @@ %PDF-1.4 +%\xD0\xD4\xC5\xD8 5 0 obj << /S /GoTo /D (Section.0.Introduction.1) >> endobj @@ -12,13 +13,13 @@ (Examples) endobj 13 0 obj -<< /S /GoTo /D (Subsection.2.0.Schools data.2) >> +<< /S /GoTo /D (Subsection.2.0.Schools\040data.2) >> endobj 16 0 obj (Schools data) endobj 17 0 obj -<< /S /GoTo /D (Subsection.2.1.Leukaemia registration data.2) >> +<< /S /GoTo /D (Subsection.2.1.Leukaemia\040registration\040data.2) >> endobj 20 0 obj (Leukaemia registration data) @@ -30,25 +31,25 @@ (Implementation) endobj 25 0 obj -<< /S /GoTo /D (Section.3.Examples continued.1) >> +<< /S /GoTo /D (Section.3.Examples\040continued.1) >> endobj 28 0 obj (Examples continued) endobj 29 0 obj -<< /S /GoTo /D (Subsection.4.0.Schools data.2) >> +<< /S /GoTo /D (Subsection.4.0.Schools\040data.2) >> endobj 32 0 obj (Schools data) endobj 33 0 obj -<< /S /GoTo /D (Subsection.4.1.Leukaemia registration data.2) >> +<< /S /GoTo /D (Subsection.4.1.Leukaemia\040registration\040data.2) >> endobj 36 0 obj (Leukaemia registration data) endobj 37 0 obj -<< /S /GoTo /D (Section..Help page for the function bugs().1) >> +<< /S /GoTo /D (Section..Help\040page\040for\040the\040function\040bugs\(\).1) >> endobj 40 0 obj (Help page for the function bugs\(\)) @@ -63,56 +64,51 @@ << /S /GoTo /D [46 0 R /Fit ] >> endobj 48 0 obj << -/Length 4898 +/Length 4894 /Filter /FlateDecode >> stream -x\xDA\xD5\Ks9\x92\xBE\xEBW0\xE6\xB0AE\x98\xD5xU蹬\xDD\xDB\xED\x98ޞ\x8DYˎ9\x8C\xE7@\x93\xC50)jH\xB15\xFD\xEB\x9B<\xAB\x8A\x94\xB4\x8F\xC3F\xAD"\x91H$\x89\xCC/\xA8\x96\xFFɉ\xDB\xDA\xC6\xEBv\xB2\xD8]\x89\xC9~}%C\xABQ\xFE\x8E4\xCCZ\xA9'\xB3\xA2经W\xDF\xFD\xD4鉴\x8D\x92\xED\xE4\xE3\xEDD\xDBtFM\xAC\x92\x8D4~\xF2q\xF9\x97\xE9\x87k9U\xDE\xC0\xBF\xF7\xF0y\xF7\xE9\xFD\xCD\xF5_?\xFEm\xD1Q -\xD5h\xD3\xC28\xD8\xE5{\xA4\x98\xCC\x94ҍlaL\xE0楥\xA6\xB7\xD73m\xCD\xF4O\xD7ZM\xE7\xC0oq\xAD\xE5\xF4\xEBu\xA7\xE9\xDB>+\xA4h\xA7\xB7\xF0\xB8\x87ρ;|8\xDDߓk݊Rl\xA1a\x808\xFA\x9F\x81\x8CH\xDF}\x82G\xC5u\xF0ԙ@K\xA3\xF0h\xBB\xEE\xA6kD\xE7\xF1\x87\xCC -&\xD5\xC1Lk\xB5\xF0 Z@\xC2\xE1\xCE\xEE<l\xC3'L\xEE\xE6\x9EO\xFC\xF77dx\xF5\xE3ǴLJt\x8Dj']\xEB\xE4,/$\xFC\xC9a=\x89\x8F\x8Ae -fEZYf\xD2x\xCB -b\x9EVI\xB1|\x9F\x85\xD0/\xBAgC\xE7s\xDFx\xB0%\xB4%\x9AV\xE8Iׂⴢ\xD1~\xBAvf:_\+;\xBD\xBBV3S\xDDt\x85j_m\xC8\xA84\xA9\xA67\xF053y\x8C_\x83]5֙Ɍ\xA0#\xF6\x9F\xEEůȜ\xD87\xC4;h\xDFtd\x8Dю\xE8\xFF\x93~GU\xC6_`0\xFC_\xD0A\x82Ju -\x96\xBF\xE4\xC1aT0\xB70:\xAB\xF2=\xCE\xFB\xEC\xE6\xF78\xFE\xB7\x91\xB2u\xDD6\xAEBC\x8F'\xDC\xC1(~ sXǍp쯏V\xA0d\xAF_a\xB1\xC7%\xE3H\\xEB\xF8\xF6\xA2\xA1{\xB6qv\xB0\xC28T+\xC0\xFDt\xFF\xB7\xC6\xD1\xFE3a)\xDA\xD28\xDE"\xE3\xE5a\xF5\xC4\xEE\xEF\xFDjKCJr\x93\xF7\xFD\xD51N\xC0\xC0\xF2\x86{\2\x8Cĵ0\x8C\xDF^4t\xCF0\xCEV\x86\xB6\xAEi]\xED5P߫\x9CtR\xFA\x8A\x94\xD6c\xFB\x9CQ,hM\x80\xB5ԕQ\xFC\xB0G\x85\x9E\xE2:~ \xF4sd\xA8/\x98L\\xC1\x896MW-\xF4'\x94\xE2m_=\xAB;p\x99-\x98<L\xFAoW\xF9\xAB\x98,AC?_\x89F{7y j\xA4\xF7\x93\xDDEnz\xDE^\xDD\\xFD{\xE2!\xF8\\xEA\x93\xA2\xB2+U<\xF4\xCF6ж\xE3\xB4sIն-x\xB4.\xEC\x8B4\xD1\xE0\xBEq\x8E؊aw\x943\x91dh\xB1\xB5\xB2\xB1\xA3\xEB\xE2y՞\xC0\x80\x85\xFD4\xCB\xFD\xD9D\x96K*\xD7X\xE9\xE3(\xD6\xC7;\x8A\x9A\xBCgtA\xEA!(\xCB\x94\xC7!J\xC9̪1\xE4?\x84\x8D\x9EŃ\xE3hm\x85>\xE0+\xF6\xD8\xFA놶7\xB9cjZ\xA8pO\xADd\xD1ZV\xF4g\xDBMo\xA3oX\xEBܤ\x8E`M\xCC\xEB\x91~"\xF2E\x89\x91\x8Bo\x8B\xF9:\xEA\xF3\xE2lh\xA2\xF0)!N9]\xA3`7E\xD0r{(\xB0M\xC9\x80\x99\xF3\xA6\x866\x95\xD2\xE0A\x85\xE6\x86\xE5\xFC͆\xE7a\xCD\xD8\xF9ic\x9A\xF7x\xF8\x96\xB1\xE3c\x82U<\xB9\xB4-\xAB\xC9"D\x9Ai\xEF\xA7O\x87M "e{G\xCFwaY\x80`Y\xF0\xC1\xAD\xEAm\xF0\x87\xB8D\xD4ሬ\x89\xCDC\xA0\x9C\xD8:\xE81\xF4\xBC%x\x99E\xA3\xB6\xC3j\xD6{N\xF8-\xC36\x8F\x81 \x96\xF7ۈ; |
From: Luke T. <lu...@st...> - 2007-05-16 13:05:47
|
On Mon, 14 May 2007, Uwe Ligges wrote: > Luke, > > codetools are extremly useful and already revealed several bugs in the > packages I am maintaining. Simply outstanding! Thanks! > There is a little problem when one tries to maintain a package for both CRAN > and CSAN. E.g., R2WinBUGS has been ported to S-PLUS by Insightful and we try > to use the same package for both R and S-PLUS. Now, your codetools are > claiming that objects and functions are missing for parts of the code that > are only executed in S-PLUS. Therefore, it would be nice if the codetools > could ignore parts of the code in > > if(!is.R()){ > HERE > } > > or > > if(is.R()){ > ...... > } else { > HERE > } > > > I'm not even sure if it is really desirable to ignore the HERE parts. At > least, when more R packages will be ported to S-PLUS, we will see a bunch of > warnings in the daily check results on CRAN "just" caused by the reason > mentioned above. This issue is fairly high on my priority list. With is.R it _may_ be clear what to do, i.e. ignore the FALSE cases. A little tougher is ones that test for Windows, e.g.. Ideally it would be nice to have enough information about what goes on on Windows to test code for Windows on Linux. Best, luke -- Luke Tierney Chair, Statistics and Actuarial Science Ralph E. Wareham Professor of Mathematical Sciences University of Iowa Phone: 319-335-3386 Department of Statistics and Fax: 319-335-3017 Actuarial Science 241 Schaeffer Hall email: lu...@st... Iowa City, IA 52242 WWW: http://www.stat.uiowa.edu |
From: Uwe L. <li...@st...> - 2007-05-15 16:32:32
|
Dawn Woodard wrote: > The documentation for the function bugs in R2WinBUGS.pdf has not been updated > to reflect the changes in the new release. Good point, if we do so, we shouls state that the vignette is an updated version of the original paper. Any objections, Sibylle? Uwe > Dawn > > -----Original Message----- > From: bug...@li... > [mailto:bug...@li...] On Behalf Of Uwe Ligges > Sent: Monday, May 14, 2007 4:31 AM > To: gre...@bf... > Cc: bug...@li... > Subject: Re: [Bugs-r-devel] Codetools and S-PLUS (was R2WinBUGS_2.1-3.tar.gz) > > > > Gregor Gorjanc wrote: >> Uwe Ligges wrote: >> ... >>>> You mean that package R2WinBUGS would hold definitions for S-PLUS >>>> specific functions? >>> It already does hold S-PLUS specific functions, thanks to Dawn. But this >>> leads to warnings in the R checks on CRAN, because codetools does not >>> know that code in if(!is.R()){HERE} should not be inspected. The >>> above idea is some dirty trick to calm codetools down ... >> Aha. Now I get it. Your solution is possible. I guess that there will be >> more packages with the same problem. Maybe you could ask maintainer of >> codetools about a more general approach? >> >> Gregor > > Good idea, I'll contact Luke. > > Uwe > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Bugs-r-devel mailing list > Bug...@li... > https://lists.sourceforge.net/lists/listinfo/bugs-r-devel > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Bugs-r-devel mailing list > Bug...@li... > https://lists.sourceforge.net/lists/listinfo/bugs-r-devel |
From: Uwe L. <li...@st...> - 2007-05-15 16:27:39
|
Dawn, thank you and sorry. I thought that library(pkgutils) enables S-PLUS for "foo::bar" to find something called "bar" in ANY package (which is not guaranteed to be "foo") in the search path. The problem is that R will now shout again now. I'll work on another solution together with sanitizing some codetools hickups. Uwe woo...@us... wrote: > Revision: 18 > http://svn.sourceforge.net/bugs-r/?rev=18&view=rev > Author: woodard_ > Date: 2007-05-15 07:57:29 -0700 (Tue, 15 May 2007) > > Log Message: > ----------- > There are no namespaces in S-PLUS. Changed the read.bugs function to avoid the syntax <pkg_name>::<fn_name> in S-PLUS. > > Modified Paths: > -------------- > trunk/R2WinBUGS/R/read.bugs.R > > Modified: trunk/R2WinBUGS/R/read.bugs.R > =================================================================== > --- trunk/R2WinBUGS/R/read.bugs.R 2007-05-13 16:49:34 UTC (rev 17) > +++ trunk/R2WinBUGS/R/read.bugs.R 2007-05-15 14:57:29 UTC (rev 18) > @@ -1,7 +1,13 @@ > read.bugs <- function(codafiles, ...){ > if(!require(coda)) > stop("package 'coda' is required to use this function") > - coda::mcmc.list(lapply(codafiles, coda::read.coda, > - index.file = file.path(dirname(codafiles[1]), "codaIndex.txt"), > - ...)) > + if (is.R()){ > + coda::mcmc.list(lapply(codafiles, coda::read.coda, > + index.file = file.path(dirname(codafiles[1]), "codaIndex.txt"), > + ...)) > + }else{ > + mcmc.list(lapply(codafiles, read.coda, > + index.file = file.path(dirname(codafiles[1]), "codaIndex.txt"), > + ...)) > + } > } > > > This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Bugs-r-devel mailing list > Bug...@li... > https://lists.sourceforge.net/lists/listinfo/bugs-r-devel |
From: Dawn W. <dwo...@in...> - 2007-05-15 15:17:29
|
The documentation for the function bugs in R2WinBUGS.pdf has not been = updated to reflect the changes in the new release. Dawn -----Original Message----- From: bug...@li... [mailto:bug...@li...] On Behalf Of Uwe = Ligges Sent: Monday, May 14, 2007 4:31 AM To: gre...@bf... Cc: bug...@li... Subject: Re: [Bugs-r-devel] Codetools and S-PLUS (was = R2WinBUGS_2.1-3.tar.gz) Gregor Gorjanc wrote: > Uwe Ligges wrote: > ... >>> You mean that package R2WinBUGS would hold definitions for S-PLUS >>> specific functions? >> It already does hold S-PLUS specific functions, thanks to Dawn. But = this >> leads to warnings in the R checks on CRAN, because codetools does not >> know that code in if(!is.R()){HERE} should not be inspected. The >> above idea is some dirty trick to calm codetools down ... >=20 > Aha. Now I get it. Your solution is possible. I guess that there will = be > more packages with the same problem. Maybe you could ask maintainer of > codetools about a more general approach? >=20 > Gregor Good idea, I'll contact Luke. Uwe -------------------------------------------------------------------------= This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Bugs-r-devel mailing list Bug...@li... https://lists.sourceforge.net/lists/listinfo/bugs-r-devel |
From: <woo...@us...> - 2007-05-15 14:59:43
|
Revision: 18 http://svn.sourceforge.net/bugs-r/?rev=18&view=rev Author: woodard_ Date: 2007-05-15 07:57:29 -0700 (Tue, 15 May 2007) Log Message: ----------- There are no namespaces in S-PLUS. Changed the read.bugs function to avoid the syntax <pkg_name>::<fn_name> in S-PLUS. Modified Paths: -------------- trunk/R2WinBUGS/R/read.bugs.R Modified: trunk/R2WinBUGS/R/read.bugs.R =================================================================== --- trunk/R2WinBUGS/R/read.bugs.R 2007-05-13 16:49:34 UTC (rev 17) +++ trunk/R2WinBUGS/R/read.bugs.R 2007-05-15 14:57:29 UTC (rev 18) @@ -1,7 +1,13 @@ read.bugs <- function(codafiles, ...){ if(!require(coda)) stop("package 'coda' is required to use this function") - coda::mcmc.list(lapply(codafiles, coda::read.coda, - index.file = file.path(dirname(codafiles[1]), "codaIndex.txt"), - ...)) + if (is.R()){ + coda::mcmc.list(lapply(codafiles, coda::read.coda, + index.file = file.path(dirname(codafiles[1]), "codaIndex.txt"), + ...)) + }else{ + mcmc.list(lapply(codafiles, read.coda, + index.file = file.path(dirname(codafiles[1]), "codaIndex.txt"), + ...)) + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Uwe L. <li...@st...> - 2007-05-14 09:14:43
|
Luke, codetools are extremly useful and already revealed several bugs in the packages I am maintaining. Simply outstanding! There is a little problem when one tries to maintain a package for both CRAN and CSAN. E.g., R2WinBUGS has been ported to S-PLUS by Insightful and we try to use the same package for both R and S-PLUS. Now, your codetools are claiming that objects and functions are missing for parts of the code that are only executed in S-PLUS. Therefore, it would be nice if the codetools could ignore parts of the code in if(!is.R()){ HERE } or if(is.R()){ ...... } else { HERE } I'm not even sure if it is really desirable to ignore the HERE parts. At least, when more R packages will be ported to S-PLUS, we will see a bunch of warnings in the daily check results on CRAN "just" caused by the reason mentioned above. Best, Uwe |
From: Uwe L. <li...@st...> - 2007-05-14 08:30:40
|
Gregor Gorjanc wrote: > Uwe Ligges wrote: > ... >>> You mean that package R2WinBUGS would hold definitions for S-PLUS >>> specific functions? >> It already does hold S-PLUS specific functions, thanks to Dawn. But this >> leads to warnings in the R checks on CRAN, because codetools does not >> know that code in if(!is.R()){HERE} should not be inspected. The >> above idea is some dirty trick to calm codetools down ... > > Aha. Now I get it. Your solution is possible. I guess that there will be > more packages with the same problem. Maybe you could ask maintainer of > codetools about a more general approach? > > Gregor Good idea, I'll contact Luke. Uwe |
From: Gregor G. <gre...@bf...> - 2007-05-14 08:28:12
|
Uwe Ligges wrote: ... >> You mean that package R2WinBUGS would hold definitions for S-PLUS >> specific functions? > > It already does hold S-PLUS specific functions, thanks to Dawn. But this > leads to warnings in the R checks on CRAN, because codetools does not > know that code in if(!is.R()){HERE} should not be inspected. The > above idea is some dirty trick to calm codetools down ... Aha. Now I get it. Your solution is possible. I guess that there will be more packages with the same problem. Maybe you could ask maintainer of codetools about a more general approach? Gregor |
From: Uwe L. <li...@st...> - 2007-05-14 08:16:08
|
Gregor Gorjanc wrote: > Hi! > >>>>>> Uwe Ligges writes: >> This version will work for S-PLUS as well, thanks to Dawn Woodard and >> Insightful for porting it. > >> Not that easy to convince codetools if some parts of the sources are >> made for S-PLUS only ... (Dawn, you might want to look at my changes). >> The last (unremovable) Warnings from codetools are due to the fact that >> the calling functions are only used in S-PLUS and the objects codetools >> is warning about do exist in S-PLUS but not in R. >> The only alternative that springs to mind would be to create some fake >> functions such as > >> if(is.R()){ >> foo <- function(......) >> stop("This function will never be called in R") >> } else { >> foo <- function(......) >> real Definition >> } > > You mean that package R2WinBUGS would hold definitions for S-PLUS > specific functions? It already does hold S-PLUS specific functions, thanks to Dawn. But this leads to warnings in the R checks on CRAN, because codetools does not know that code in if(!is.R()){HERE} should not be inspected. The above idea is some dirty trick to calm codetools down ... Uwe > Gregor > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Bugs-r-devel mailing list > Bug...@li... > https://lists.sourceforge.net/lists/listinfo/bugs-r-devel |
From: Gregor G. <gre...@bf...> - 2007-05-14 08:12:57
|
Hi! >>>>> Uwe Ligges writes: > This version will work for S-PLUS as well, thanks to Dawn Woodard and > Insightful for porting it. > Not that easy to convince codetools if some parts of the sources are > made for S-PLUS only ... (Dawn, you might want to look at my changes). > The last (unremovable) Warnings from codetools are due to the fact that > the calling functions are only used in S-PLUS and the objects codetools > is warning about do exist in S-PLUS but not in R. > The only alternative that springs to mind would be to create some fake > functions such as > if(is.R()){ > foo <- function(......) > stop("This function will never be called in R") > } else { > foo <- function(......) > real Definition > } You mean that package R2WinBUGS would hold definitions for S-PLUS specific functions? Gregor |
From: <li...@us...> - 2007-05-13 16:49:33
|
Revision: 17 http://svn.sourceforge.net/bugs-r/?rev=17&view=rev Author: ligges Date: 2007-05-13 09:49:34 -0700 (Sun, 13 May 2007) Log Message: ----------- The codetools checks revealed quite a lot of bugs and inconsistencies. Unfortunately we cannot make codetools calm since codetools do not expect S-PLUS. Again, prepared for release. Modified Paths: -------------- trunk/R2WinBUGS/Changes trunk/R2WinBUGS/DESCRIPTION trunk/R2WinBUGS/R/attach.all.R trunk/R2WinBUGS/R/bugs.R trunk/R2WinBUGS/R/bugs.data.R trunk/R2WinBUGS/R/bugs.run.R trunk/R2WinBUGS/R/bugs.script.R trunk/R2WinBUGS/R/bugs.update.settings.R trunk/R2WinBUGS/R/openbugs.R trunk/R2WinBUGS/R/read.bugs.R trunk/R2WinBUGS/R/wineutils.R trunk/R2WinBUGS/R/write.model.R trunk/R2WinBUGS/man/bugs.run.Rd Modified: trunk/R2WinBUGS/Changes =================================================================== --- trunk/R2WinBUGS/Changes 2007-05-13 11:43:49 UTC (rev 16) +++ trunk/R2WinBUGS/Changes 2007-05-13 16:49:34 UTC (rev 17) @@ -70,5 +70,7 @@ - print.bugs / plot.bugs documentation fixes - write.model() fix -Update 2.1-2 (12 May 2007): +Update 2.1-3 (13 May 2007): - Ported to S-PLUS by Insightful Corp. +- some fixes for codetools checks + Modified: trunk/R2WinBUGS/DESCRIPTION =================================================================== --- trunk/R2WinBUGS/DESCRIPTION 2007-05-13 11:43:49 UTC (rev 16) +++ trunk/R2WinBUGS/DESCRIPTION 2007-05-13 16:49:34 UTC (rev 17) @@ -1,7 +1,7 @@ Package: R2WinBUGS Title: Running WinBUGS and OpenBUGS from R / S-PLUS -Date: 2007-05-12 -Version: 2.1-2 +Date: 2007-05-13 +Version: 2.1-3 Author: originally written by Andrew Gelman <ge...@st...>; changes and packaged by Sibylle Sturtz <st...@st...> and Uwe Ligges <li...@st...>. Modified: trunk/R2WinBUGS/R/attach.all.R =================================================================== --- trunk/R2WinBUGS/R/attach.all.R 2007-05-13 11:43:49 UTC (rev 16) +++ trunk/R2WinBUGS/R/attach.all.R 2007-05-13 16:49:34 UTC (rev 17) @@ -29,10 +29,7 @@ detach("bugs.sims")} x$sims.list$n.sims <- x$n.sims # put n.sims into sims.list for convenience r2 <- attach.all(x$sims.list, overwrite = overwrite, name = "bugs.sims") - if (is.R()) - invisible (bugs.sims = r2) - else - invisible (r2) + invisible (r2) } detach.all <- function(name = "attach.all"){ Modified: trunk/R2WinBUGS/R/bugs.R =================================================================== --- trunk/R2WinBUGS/R/bugs.R 2007-05-13 11:43:49 UTC (rev 16) +++ trunk/R2WinBUGS/R/bugs.R 2007-05-13 16:49:34 UTC (rev 17) @@ -60,7 +60,7 @@ bugs.script(parameters.to.save, n.chains, n.iter, n.burnin, n.thin, new.model.file, debug=debug, is.inits=!is.null(inits), bin = bin, DIC = DIC, useWINE = useWINE, newWINE = newWINE, WINEPATH = WINEPATH) - bugs.run(n.burnin, bugs.directory, WINE = WINE, useWINE = useWINE) + bugs.run(n.burnin, bugs.directory, WINE = WINE, useWINE = useWINE, WINEPATH = WINEPATH) if(codaPkg) return(file.path(getwd(), paste("coda", 1:n.chains, ".txt", sep=""))) Modified: trunk/R2WinBUGS/R/bugs.data.R =================================================================== --- trunk/R2WinBUGS/R/bugs.data.R 2007-05-13 11:43:49 UTC (rev 16) +++ trunk/R2WinBUGS/R/bugs.data.R 2007-05-13 16:49:34 UTC (rev 17) @@ -1,29 +1,28 @@ "bugs.data" <- function(data, dir = getwd(), digits = 5){ if(is.numeric(unlist(data))) - if(is.R()) { - write.datafile(lapply(data, formatC, digits = digits, format = "E"), - file.path(dir, "data.txt")) - } - else { - writeDatafileS4(data, towhere = "data.txt") - } + if(is.R()) { + write.datafile(lapply(data, formatC, digits = digits, format = "E"), + file.path(dir, "data.txt")) + } + else { + writeDatafileS4(data, towhere = "data.txt") + } else { - if(is.R()) { - data.list <- lapply(as.list(data), get, pos = parent.frame(2)) - names(data.list) <- as.list(data) - write.datafile(lapply(data.list, formatC, digits = digits, format = "E"), - file.path(dir, "data.txt")) - } - else { - data.list <- lapply(as.list(data), get, where = parent.frame(2)) - names(data.list) <- unlist(data) - writeDatafileS4(data.list, towhere = "data.txt") - } - } + if(is.R()) { + data.list <- lapply(as.list(data), get, pos = parent.frame(2)) + names(data.list) <- as.list(data) + write.datafile(lapply(data.list, formatC, digits = digits, format = "E"), + file.path(dir, "data.txt")) + } + else { + data.list <- lapply(as.list(data), get, where = parent.frame(2)) + names(data.list) <- unlist(data) + writeDatafileS4(data.list, towhere = "data.txt") + } + } } -if (!is.R()) { "writeDatafileS4" <- # @@ -50,128 +49,128 @@ # Revision history: 2002-11-19. Fixed to handle missing values properly. function(DATA, towhere = "clipboard", fill = TRUE) { - formatDataS4 = - # - # Prepared DATA for input to WinBUGS. - function(DATA) - { - if(!is.list(DATA)) - stop("DATA must be a named list or data frame.") - dlnames <- names(DATA) - if(is.data.frame(DATA)) - DATA <- as.list(DATA) - # - # Checking for lists in DATA.... - lind <- sapply(DATA, is.list) - # Checking for data frames in DATA.... - dfind <- sapply(DATA, is.data.frame) - # Any lists that are not data frames?... - if(any(lind & !dfind)) stop("DATA may not contain lists.") - # Checking for unnamed elements of list that are not data frames.... - if(any(dlnames[!dfind] == "")) stop( - "When DATA is a list, all its elements that are not data frames must be named." - ) - # Checking for duplicate names.... - dupnames <- unique(dlnames[duplicated(dlnames)]) - if(length(dupnames) > 0) - stop(paste( - "The following names are used more than once in DATA:", - paste(dupnames, collapse = ", "))) - if(any(dfind)) { - dataold <- DATA - DATA <- vector("list", 0) - for(i in seq(along = dataold)) { - if(dfind[i]) - DATA <- c(DATA, as.list(dataold[[i]])) - else DATA <- c(DATA, dataold[i]) - } - dataold <- NULL - } - dlnames <- names(DATA) - dupnames <- unique(dlnames[duplicated(dlnames)]) - # Checking for duplicated names again (now that columns of data frames are included).... - if(length(dupnames) > 0) stop(paste( - "The following names are used more than once in DATA (at least once within a data frame):", - paste(dupnames, collapse = ", "))) - # Checking for factors.... - factorind <- sapply(DATA, is.factor) - if(any(factorind)) - stop(paste( - "DATA may not include factors. One or more factor variables were detected:", - paste(dlnames[factorind], collapse = ", "))) - # Checking for character vectors.... - charind <- sapply(DATA, is.character) - if(any(charind)) - stop(paste( - "WinBUGS does not handle character data. One or more character variables were detected:", - paste(dlnames[charind], collapse = ", "))) - # Checking for complex vectors.... - complexind <- sapply(DATA, is.complex) - if(any(complexind)) - stop(paste( - "WinBUGS does not handle complex data. One or more complex variables were detected:", - paste(dlnames[complexind], collapse = ", "))) - # Checking for values farther from zero than 1E+38 (which is limit of single precision).... - toobigind <- sapply(DATA, function(x) - { - y <- abs(x[!is.na(x)]) - any(y[y > 0] > 9.9999999999999998e+37) - } - ) - if(any(toobigind)) - stop(paste( - "WinBUGS works in single precision. The following variables contain data outside the range +/-1.0E+38: ", - paste(dlnames[toobigind], collapse = ", "), - ".\n", sep = "")) - # Checking for values in range +/-1.0E-38 (which is limit of single precision).... - toosmallind <- sapply(DATA, function(x) - { - y <- abs(x[!is.na(x)]) - any(y[y > 0] < 9.9999999999999996e-39) - } - ) - n <- length(dlnames) - data.string <- as.list(rep(NA, n)) - for(i in 1:n) { - if(length(DATA[[i]]) == 1) { - ac <- toSingleS4(DATA[[i]]) - data.string[[i]] <- paste(names(DATA)[i], "=", - ac, sep = "") - next - } - if(is.vector(DATA[[i]]) & length(DATA[[i]]) > 1) { - ac <- toSingleS4(DATA[[i]]) - data.string[[i]] <- paste(names(DATA)[i], "=c(", - paste(ac, collapse = ", "), ")", sep = - "") - next - } - if(is.array(DATA[[i]])) { - ac <- toSingleS4(aperm(DATA[[i]])) - data.string[[i]] <- paste(names(DATA)[i], - "= structure(.Data= c(", paste(ac, - collapse = ", "), "), \n .Dim=c(", - paste(as.character(dim(DATA[[i]])), - collapse = ", "), "))", sep = "") - } - } - data.tofile <- paste("list(", paste(unlist(data.string), - collapse = ", "), ")", sep = "") - if(any(toosmallind)) - warning(paste( - "WinBUGS works in single precision. The following variables contained nonzero data", - "\ninside the range +/-1.0E-38 that were set to zero: ", - paste(dlnames[toosmallind], collapse = ", "), - ".\n", sep = "")) - return(data.tofile) - } - rslt <- formatDataS4(DATA) - cat(rslt, file = towhere, fill = fill) - invisible(0) + formatDataS4 = + # + # Prepared DATA for input to WinBUGS. + function(DATA) + { + if(!is.list(DATA)) + stop("DATA must be a named list or data frame.") + dlnames <- names(DATA) + if(is.data.frame(DATA)) + DATA <- as.list(DATA) + # + # Checking for lists in DATA.... + lind <- sapply(DATA, is.list) + # Checking for data frames in DATA.... + dfind <- sapply(DATA, is.data.frame) + # Any lists that are not data frames?... + if(any(lind & !dfind)) stop("DATA may not contain lists.") + # Checking for unnamed elements of list that are not data frames.... + if(any(dlnames[!dfind] == "")) stop( + "When DATA is a list, all its elements that are not data frames must be named." + ) + # Checking for duplicate names.... + dupnames <- unique(dlnames[duplicated(dlnames)]) + if(length(dupnames) > 0) + stop(paste( + "The following names are used more than once in DATA:", + paste(dupnames, collapse = ", "))) + if(any(dfind)) { + dataold <- DATA + DATA <- vector("list", 0) + for(i in seq(along = dataold)) { + if(dfind[i]) + DATA <- c(DATA, as.list(dataold[[i]])) + else DATA <- c(DATA, dataold[i]) + } + dataold <- NULL + } + dlnames <- names(DATA) + dupnames <- unique(dlnames[duplicated(dlnames)]) + # Checking for duplicated names again (now that columns of data frames are included).... + if(length(dupnames) > 0) stop(paste( + "The following names are used more than once in DATA (at least once within a data frame):", + paste(dupnames, collapse = ", "))) + # Checking for factors.... + factorind <- sapply(DATA, is.factor) + if(any(factorind)) + stop(paste( + "DATA may not include factors. One or more factor variables were detected:", + paste(dlnames[factorind], collapse = ", "))) + # Checking for character vectors.... + charind <- sapply(DATA, is.character) + if(any(charind)) + stop(paste( + "WinBUGS does not handle character data. One or more character variables were detected:", + paste(dlnames[charind], collapse = ", "))) + # Checking for complex vectors.... + complexind <- sapply(DATA, is.complex) + if(any(complexind)) + stop(paste( + "WinBUGS does not handle complex data. One or more complex variables were detected:", + paste(dlnames[complexind], collapse = ", "))) + # Checking for values farther from zero than 1E+38 (which is limit of single precision).... + toobigind <- sapply(DATA, function(x) + { + y <- abs(x[!is.na(x)]) + any(y[y > 0] > 9.9999999999999998e+37) + } + ) + if(any(toobigind)) + stop(paste( + "WinBUGS works in single precision. The following variables contain data outside the range +/-1.0E+38: ", + paste(dlnames[toobigind], collapse = ", "), + ".\n", sep = "")) + # Checking for values in range +/-1.0E-38 (which is limit of single precision).... + toosmallind <- sapply(DATA, function(x) + { + y <- abs(x[!is.na(x)]) + any(y[y > 0] < 9.9999999999999996e-39) + } + ) + n <- length(dlnames) + data.string <- as.list(rep(NA, n)) + for(i in 1:n) { + if(length(DATA[[i]]) == 1) { + ac <- toSingleS4(DATA[[i]]) + data.string[[i]] <- paste(names(DATA)[i], "=", + ac, sep = "") + next + } + if(is.vector(DATA[[i]]) & length(DATA[[i]]) > 1) { + ac <- toSingleS4(DATA[[i]]) + data.string[[i]] <- paste(names(DATA)[i], "=c(", + paste(ac, collapse = ", "), ")", sep = + "") + next + } + if(is.array(DATA[[i]])) { + ac <- toSingleS4(aperm(DATA[[i]])) + data.string[[i]] <- paste(names(DATA)[i], + "= structure(.Data= c(", paste(ac, + collapse = ", "), "), \n .Dim=c(", + paste(as.character(dim(DATA[[i]])), + collapse = ", "), "))", sep = "") + } + } + data.tofile <- paste("list(", paste(unlist(data.string), + collapse = ", "), ")", sep = "") + if(any(toosmallind)) + warning(paste( + "WinBUGS works in single precision. The following variables contained nonzero data", + "\ninside the range +/-1.0E-38 that were set to zero: ", + paste(dlnames[toosmallind], collapse = ", "), + ".\n", sep = "")) + return(data.tofile) + } + rslt <- formatDataS4(DATA) + cat(rslt, file = towhere, fill = fill) + invisible(0) } -toSingleS4 = +toSingleS4 <- # # Takes numeric vector and removes digit of exponent in scientific notation (if any) # @@ -180,50 +179,48 @@ # Revision history: 2002-11-19. Fixed to handle missing values properly. function(x) { - xdim <- dim(x) - x <- as.character(as.single(x)) + xdim <- dim(x) + x <- as.character(as.single(x)) - # First to look for positives: - pplus <- regMatchPos(x, "e\\+0") - pplusind <- apply(pplus, 1, function(y) - (!any(is.na(y)))) - if(any(pplusind)) { - # Making sure that periods are in mantissa... - init <- substring(x[pplusind], 1, pplus[ - pplusind, 1] - 1) - #...preceeding exponent - pper <- regMatchPos(init, "\\.") - pperind <- apply(pper, 1, function(y) - (all(is.na(y)))) - if(any(pperind)) - init[pperind] <- paste(init[pperind], - ".0", sep = "") - # Changing the format of the exponent... - x[pplusind] <- paste(init, "E+", substring( - x[pplusind], pplus[pplusind, 2] + 1), - sep = "") - } - # Then to look for negatives: - pminus <- regMatchPos(x, "e\\-0") - pminusind <- apply(pminus, 1, function(y) - (!any(is.na(y)))) - if(any(pminusind)) { - # Making sure that periods are in mantissa... - init <- substring(x[pminusind], 1, pminus[ - pminusind, 1] - 1) - #...preceeding exponent - pper <- regMatchPos(init, "\\.") - pperind <- apply(pper, 1, function(y) - (all(is.na(y)))) - if(any(pperind)) - init[pperind] <- paste(init[pperind], - ".0", sep = "") - # Changing the format of the exponent... - x[pminusind] <- paste(init, "E-", substring( - x[pminusind], pminus[pminusind, 2] + - 1), sep = "") - } - x + # First to look for positives: + pplus <- regMatchPos(x, "e\\+0") + pplusind <- apply(pplus, 1, function(y) + (!any(is.na(y)))) + if(any(pplusind)) { + # Making sure that periods are in mantissa... + init <- substring(x[pplusind], 1, pplus[ + pplusind, 1] - 1) + #...preceeding exponent + pper <- regMatchPos(init, "\\.") + pperind <- apply(pper, 1, function(y) + (all(is.na(y)))) + if(any(pperind)) + init[pperind] <- paste(init[pperind], + ".0", sep = "") + # Changing the format of the exponent... + x[pplusind] <- paste(init, "E+", substring( + x[pplusind], pplus[pplusind, 2] + 1), + sep = "") + } + # Then to look for negatives: + pminus <- regMatchPos(x, "e\\-0") + pminusind <- apply(pminus, 1, function(y) + (!any(is.na(y)))) + if(any(pminusind)) { + # Making sure that periods are in mantissa... + init <- substring(x[pminusind], 1, pminus[ + pminusind, 1] - 1) + #...preceeding exponent + pper <- regMatchPos(init, "\\.") + pperind <- apply(pper, 1, function(y) + (all(is.na(y)))) + if(any(pperind)) + init[pperind] <- paste(init[pperind], + ".0", sep = "") + # Changing the format of the exponent... + x[pminusind] <- paste(init, "E-", substring( + x[pminusind], pminus[pminusind, 2] + + 1), sep = "") + } + x } - -} # ends if (!is.R()) Modified: trunk/R2WinBUGS/R/bugs.run.R =================================================================== --- trunk/R2WinBUGS/R/bugs.run.R 2007-05-13 11:43:49 UTC (rev 16) +++ trunk/R2WinBUGS/R/bugs.run.R 2007-05-13 16:49:34 UTC (rev 17) @@ -1,6 +1,7 @@ "bugs.run" <- function(n.burnin, bugs.directory, WINE = "", - useWINE = .Platform$OS.type != "windows", newWINE = TRUE){ + useWINE = .Platform$OS.type != "windows", + newWINE = TRUE, WINEPATH = NULL){ if(useWINE && !is.R()) stop ("Non-Windows platforms not yet supported in R2WinBUGS for S-PLUS") @@ -26,7 +27,7 @@ stop(paste("WinBUGS executable does not exist in", bugs.directory)) ## Call Bugs and have it run with script.txt bugsCall <- paste("\"", dos.location, "\" /par \"", - native2win(file.path(getwd(), "script.txt"), newWINE = newWINE), + native2win(file.path(getwd(), "script.txt"), newWINE = newWINE, WINEPATH = WINEPATH), "\"", sep = "") if (useWINE) bugsCall <- paste(WINE, bugsCall) Modified: trunk/R2WinBUGS/R/bugs.script.R =================================================================== --- trunk/R2WinBUGS/R/bugs.script.R 2007-05-13 11:43:49 UTC (rev 16) +++ trunk/R2WinBUGS/R/bugs.script.R 2007-05-13 16:49:34 UTC (rev 17) @@ -17,7 +17,8 @@ coda <- file.path(working.directory, "coda") logfile <- file.path(working.directory, "log.odc") logfileTxt <- file.path(working.directory, "log.txt") - inits <- sapply(paste(working.directory, "/inits", 1:n.chains, ".txt", sep=""), native2win) + inits <- sapply(paste(working.directory, "/inits", 1:n.chains, ".txt", sep=""), + function(x) native2win(x, , WINEPATH = WINEPATH)) initlist <- paste("inits (", 1:n.chains, ", '", inits, "')\n", sep="") savelist <- paste("set (", parameters.to.save, ")\n", sep="") redo <- ceiling((n.iter-n.burnin)/(n.thin*bin)) @@ -34,15 +35,15 @@ ## Therefore, if the samples are read into S-PLUS using the coda package, ## the thinning will be correctly labelled in the resulting mcmc object. ## In R, the thinning is always labelled as 1, even if thinning was done. - thinUpdateCommand <- paste("update (", n.burnin, ")\n", - "thin.samples (", n.thin, ")\n", sep = "") - bin = bin * n.thin + thinUpdateCommand <- paste("update (", n.burnin, ")\n", + "thin.samples (", n.thin, ")\n", sep = "") + bin = bin * n.thin } cat( "display ('log')\n", - "check ('", native2win(model), "')\n", - "data ('", native2win(data), "')\n", + "check ('", native2win(model, WINEPATH=WINEPATH), "')\n", + "data ('", native2win(data, WINEPATH=WINEPATH), "')\n", "compile (", n.chains, ")\n", if(is.inits) initlist, "gen.inits()\n", @@ -51,12 +52,12 @@ if(DIC) "dic.set()\n", rep( c("update (", formatC(ceiling(bin), format = "d"), ")\n", - "coda (*, '", native2win(coda), "')\n"),redo), + "coda (*, '", native2win(coda, WINEPATH=WINEPATH), "')\n"),redo), "stats (*)\n", if(DIC) "dic.stats()\n", - "history (*, '", native2win(history), "')\n", - "save ('", native2win(logfile), "')\n", - "save ('", native2win(logfileTxt), "')\n", + "history (*, '", native2win(history, WINEPATH=WINEPATH), "')\n", + "save ('", native2win(logfile, WINEPATH=WINEPATH), "')\n", + "save ('", native2win(logfileTxt, WINEPATH=WINEPATH), "')\n", file=script, sep="", append=FALSE) if (!debug) cat ("quit ()\n", file=script, append=TRUE) sims.files <- paste ("coda", 1:n.chains, ".txt", sep="") Modified: trunk/R2WinBUGS/R/bugs.update.settings.R =================================================================== --- trunk/R2WinBUGS/R/bugs.update.settings.R 2007-05-13 11:43:49 UTC (rev 16) +++ trunk/R2WinBUGS/R/bugs.update.settings.R 2007-05-13 16:49:34 UTC (rev 17) @@ -1,13 +1,13 @@ "bugs.update.settings" <- function (n.burnin, bugs.directory){ - + char.burnin <- as.character(n.burnin - 1) - if (is.R()){ - file.copy(file.path(bugs.directory, "System/Rsrc/Registry.odc"), + if (is.R()){ + file.copy(file.path(bugs.directory, "System/Rsrc/Registry.odc"), file.path(bugs.directory, "System/Rsrc/Registry_Rsave.odc"), overwrite = TRUE) } else { - splus.file.copy(file.path(bugs.directory, "System/Rsrc/Registry.odc"), + splus.file.copy(file.path(bugs.directory, "System/Rsrc/Registry.odc"), file.path(bugs.directory, "System/Rsrc/Registry_Rsave.odc"), overwrite = TRUE) } @@ -15,19 +15,19 @@ "character", 400, size = 1, endian = "little") locale <- Sys.getlocale("LC_CTYPE") Sys.setlocale("LC_CTYPE", "C") - if (is.R()) - info <- registry[regexpr("Int", registry, fixed = TRUE, useBytes = TRUE) > 0] - else - info <- registry[regexpr("Int", registry, fixed = TRUE) > 0] + if (is.R()) + info <- registry[regexpr("Int", registry, fixed = TRUE, useBytes = TRUE) > 0] + else + info <- registry[regexpr("Int", registry, fixed = TRUE) > 0] while(regexpr("\r", info) > 0){ newline <- regexpr("\r", info) info <- substring(info, newline + 1) line <- substring(info, 1, regexpr("\r", info) - 1) if(regexpr("AdaptivePhase", line) > 0){ if (is.R()) - numpos <- regexpr("Int", line, fixed = TRUE, useBytes = TRUE) + 4 + numpos <- regexpr("Int", line, fixed = TRUE, useBytes = TRUE) + 4 else - numpos <- regexpr("Int", line, fixed = TRUE) + 4 + numpos <- regexpr("Int", line, fixed = TRUE) + 4 num <- substring(line, numpos) if (as.numeric(num) > n.burnin){ @@ -43,8 +43,6 @@ file.path(bugs.directory, "System/Rsrc/Registry.odc"), endian = "little") } -if (!is.R()){ - "splus.file.copy"<- function(from, to, overwrite = FALSE) { @@ -57,5 +55,3 @@ size = 1) invisible(z) } - -} #ends if (!is.R()) Modified: trunk/R2WinBUGS/R/openbugs.R =================================================================== --- trunk/R2WinBUGS/R/openbugs.R 2007-05-13 11:43:49 UTC (rev 16) +++ trunk/R2WinBUGS/R/openbugs.R 2007-05-13 16:49:34 UTC (rev 17) @@ -33,43 +33,43 @@ model <- readLines(modelFile) try(writeLines(model, modelFile)) } - modelCheck(modelFile) + BRugs::modelCheck(modelFile) if(!(is.vector(data) && is.character(data) && all(file.exists(data)))) { - data <- bugsData(data, digits = digits) + data <- BRugs::bugsData(data, digits = digits) } - modelData(data) - modelCompile(numChains) + BRugs::modelData(data) + BRugs::modelCompile(numChains) if(missing(inits) || is.null(inits)) { - modelGenInits() + BRugs::modelGenInits() } else { if(is.list(inits) || is.function(inits) || (is.character(inits) && !any(file.exists(inits)))){ - inits <- bugsInits(inits = inits, numChains = numChains, digits = digits) + inits <- BRugs::bugsInits(inits = inits, numChains = numChains, digits = digits) } - modelInits(inits) - modelGenInits() + BRugs::modelInits(inits) + BRugs::modelGenInits() } - samplesSetThin(nThin) + BRugs::samplesSetThin(nThin) # set the adaptive phases adaptivelines <- scan(system.file("OpenBUGS", "Bugs", "Rsrc", "Registry.txt", package="BRugs"), what="character") factories <- sub(".adaptivePhase", "", adaptivelines[grep("adaptivePhase",adaptivelines)]) - sapply(factories, modelSetAP, max(0, nBurnin-1)) + sapply(factories, BRugs::modelSetAP, max(0, nBurnin-1)) - modelUpdate(nBurnin) + BRugs::modelUpdate(nBurnin) if(!is.null(DIC)) { - dicSet() - on.exit(dicClear(), add = TRUE) + BRugs::dicSet() + on.exit(BRugs::dicClear(), add = TRUE) } - samplesSet(parametersToSave) - modelUpdate(nIter) - params <- sort.name(samplesMonitors("*"), parametersToSave) - samples <- sapply(params, samplesSample) + BRugs::samplesSet(parametersToSave) + BRugs::modelUpdate(nIter) + params <- sort.name(BRugs::samplesMonitors("*"), parametersToSave) + samples <- sapply(params, BRugs::samplesSample) n.saved.per.chain <- nrow(samples)/numChains samples.array <- array(samples, c(n.saved.per.chain, numChains, ncol(samples))) dimnames(samples.array)[[3]] <- dimnames(samples)[[2]] - if(!is.null(DIC)) DIC <- dicStats() + if(!is.null(DIC)) DIC <- BRugs::dicStats() bugs.output <- as.bugs.array(samples.array, modelFile, program="OpenBUGS", n.iter=n.iter, n.burnin=n.burnin, n.thin=n.thin, DIC=DIC) return(bugs.output) Modified: trunk/R2WinBUGS/R/read.bugs.R =================================================================== --- trunk/R2WinBUGS/R/read.bugs.R 2007-05-13 11:43:49 UTC (rev 16) +++ trunk/R2WinBUGS/R/read.bugs.R 2007-05-13 16:49:34 UTC (rev 17) @@ -1,7 +1,7 @@ read.bugs <- function(codafiles, ...){ if(!require(coda)) stop("package 'coda' is required to use this function") - mcmc.list(lapply(codafiles, read.coda, + coda::mcmc.list(lapply(codafiles, coda::read.coda, index.file = file.path(dirname(codafiles[1]), "codaIndex.txt"), ...)) } Modified: trunk/R2WinBUGS/R/wineutils.R =================================================================== --- trunk/R2WinBUGS/R/wineutils.R 2007-05-13 11:43:49 UTC (rev 16) +++ trunk/R2WinBUGS/R/wineutils.R 2007-05-13 16:49:34 UTC (rev 17) @@ -52,7 +52,7 @@ } # end if (is.R()) -native2win <- function(x, useWINE=.Platform$OS.type != "windows", newWINE=TRUE) { # native -> win +native2win <- function(x, useWINE=.Platform$OS.type != "windows", newWINE=TRUE, WINEPATH=NULL) { # native -> win if(is.R()){ if (useWINE && !newWINE) return(winedriveRTr(x)) if (useWINE && newWINE) { Modified: trunk/R2WinBUGS/R/write.model.R =================================================================== --- trunk/R2WinBUGS/R/write.model.R 2007-05-13 11:43:49 UTC (rev 16) +++ trunk/R2WinBUGS/R/write.model.R 2007-05-13 16:49:34 UTC (rev 17) @@ -21,8 +21,6 @@ writeLines(model.text, con = con) } -if (!is.R()){ - replaceScientificNotation <- function(text){ ## Change the format of any numbers in "text" that are in S-PLUS ## scientific notation to WinBUGS scientific notation @@ -31,7 +29,7 @@ ## Find the first instance ## Note that the number may or may not have a decimal point. sciNoteLoc <- regexpr("[0-9]*\\.{0,1}[0-9]*e\\+0[0-9]{2}", text) - + ## For every instance, replace the number while(sciNoteLoc > -1){ sciNoteEnd <- sciNoteLoc + attr(sciNoteLoc, "match.length")-1 @@ -54,4 +52,3 @@ text } -} ## ends if (!is.R()) Modified: trunk/R2WinBUGS/man/bugs.run.Rd =================================================================== --- trunk/R2WinBUGS/man/bugs.run.Rd 2007-05-13 11:43:49 UTC (rev 16) +++ trunk/R2WinBUGS/man/bugs.run.Rd 2007-05-13 16:49:34 UTC (rev 17) @@ -6,7 +6,8 @@ calls WinBUGS and runs it with \file{script.txt}. Intended for internal use only} \usage{ bugs.run(n.burnin, bugs.directory, WINE = "", - useWINE = .Platform$OS.type != "windows", newWINE = TRUE) + useWINE = .Platform$OS.type != "windows", + newWINE = TRUE, WINEPATH = NULL) } \arguments{ \item{n.burnin}{length of burn in} @@ -16,6 +17,8 @@ defaults to \code{TRUE} on Windows, and \code{FALSE} otherwise. The \code{useWINE = TRUE} option is not available in S-PLUS.} \item{newWINE}{set this one to \code{TRUE} for new versions of WINE.} + \item{WINEPATH}{Path the WINE, \code{bugs} tries hard to get the information automatically and + pass it to this function, if not given.} } \value{ Does not return anything. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <li...@us...> - 2007-05-13 11:44:00
|
Revision: 16 http://svn.sourceforge.net/bugs-r/?rev=16&view=rev Author: ligges Date: 2007-05-13 04:43:49 -0700 (Sun, 13 May 2007) Log Message: ----------- prepare for release Modified Paths: -------------- trunk/R2WinBUGS/Changes trunk/R2WinBUGS/DESCRIPTION Modified: trunk/R2WinBUGS/Changes =================================================================== --- trunk/R2WinBUGS/Changes 2007-05-08 22:06:05 UTC (rev 15) +++ trunk/R2WinBUGS/Changes 2007-05-13 11:43:49 UTC (rev 16) @@ -70,5 +70,5 @@ - print.bugs / plot.bugs documentation fixes - write.model() fix -Update 2.1-1 (07 April 2007): +Update 2.1-2 (12 May 2007): - Ported to S-PLUS by Insightful Corp. Modified: trunk/R2WinBUGS/DESCRIPTION =================================================================== --- trunk/R2WinBUGS/DESCRIPTION 2007-05-08 22:06:05 UTC (rev 15) +++ trunk/R2WinBUGS/DESCRIPTION 2007-05-13 11:43:49 UTC (rev 16) @@ -1,7 +1,7 @@ Package: R2WinBUGS Title: Running WinBUGS and OpenBUGS from R / S-PLUS -Date: 2007-04-07 -Version: 2.1-1 +Date: 2007-05-12 +Version: 2.1-2 Author: originally written by Andrew Gelman <ge...@st...>; changes and packaged by Sibylle Sturtz <st...@st...> and Uwe Ligges <li...@st...>. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <woo...@us...> - 2007-05-08 22:06:11
|
Revision: 15 http://svn.sourceforge.net/bugs-r/?rev=15&view=rev Author: woodard_ Date: 2007-05-08 15:06:05 -0700 (Tue, 08 May 2007) Log Message: ----------- Removed the dependency of R2WinBUGS in S-PLUS on the package rwBin. The functions readBin and writeBin are included in S-PLUS v.8.04+ Modified Paths: -------------- trunk/R2WinBUGS/R/bugs.update.settings.R Modified: trunk/R2WinBUGS/R/bugs.update.settings.R =================================================================== --- trunk/R2WinBUGS/R/bugs.update.settings.R 2007-05-08 21:58:37 UTC (rev 14) +++ trunk/R2WinBUGS/R/bugs.update.settings.R 2007-05-08 22:06:05 UTC (rev 15) @@ -1,7 +1,5 @@ "bugs.update.settings" <- function (n.burnin, bugs.directory){ - if (!is.R()) - if (!require(rwBin)) stop ("The rwBin package is required") char.burnin <- as.character(n.burnin - 1) if (is.R()){ @@ -50,7 +48,6 @@ "splus.file.copy"<- function(from, to, overwrite = FALSE) { - require(rwBin) if(!file.exists(from)) stop("File: ", from, " does not exist") if(!overwrite && file.exists(to)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <woo...@us...> - 2007-05-08 21:58:38
|
Revision: 14 http://svn.sourceforge.net/bugs-r/?rev=14&view=rev Author: woodard_ Date: 2007-05-08 14:58:37 -0700 (Tue, 08 May 2007) Log Message: ----------- Fixed the handling of numbers in scientific notation by write.model in S-PLUS. The S-PLUS scientific notation is different from the WinBUGS notation. A new function was added to change the format of all numbers in scientific notation in the model text. Modified Paths: -------------- trunk/R2WinBUGS/R/bugs.data.R trunk/R2WinBUGS/R/write.model.R Modified: trunk/R2WinBUGS/R/bugs.data.R =================================================================== --- trunk/R2WinBUGS/R/bugs.data.R 2007-05-08 21:50:38 UTC (rev 13) +++ trunk/R2WinBUGS/R/bugs.data.R 2007-05-08 21:58:37 UTC (rev 14) @@ -55,55 +55,6 @@ # Prepared DATA for input to WinBUGS. function(DATA) { - toSingleS4 = - # - # Takes numeric vector and removes digit of exponent in scientific notation (if any) - function(x) - { - xdim <- dim(x) - x <- as.character(as.single(x)) - # First to look for positives: - pplus <- regMatchPos(x, "e\\+0") - pplusind <- apply(pplus, 1, function(y) - (!any(is.na(y)))) - if(any(pplusind)) { - # Making sure that periods are in mantissa... - init <- substring(x[pplusind], 1, pplus[ - pplusind, 1] - 1) - #...preceeding exponent - pper <- regMatchPos(init, "\\.") - pperind <- apply(pper, 1, function(y) - (all(is.na(y)))) - if(any(pperind)) - init[pperind] <- paste(init[pperind], - ".0", sep = "") - # Changing the format of the exponent... - x[pplusind] <- paste(init, "E+", substring( - x[pplusind], pplus[pplusind, 2] + 1), - sep = "") - } - # Then to look for negatives: - pminus <- regMatchPos(x, "e\\-0") - pminusind <- apply(pminus, 1, function(y) - (!any(is.na(y)))) - if(any(pminusind)) { - # Making sure that periods are in mantissa... - init <- substring(x[pminusind], 1, pminus[ - pminusind, 1] - 1) - #...preceeding exponent - pper <- regMatchPos(init, "\\.") - pperind <- apply(pper, 1, function(y) - (all(is.na(y)))) - if(any(pperind)) - init[pperind] <- paste(init[pperind], - ".0", sep = "") - # Changing the format of the exponent... - x[pminusind] <- paste(init, "E-", substring( - x[pminusind], pminus[pminusind, 2] + - 1), sep = "") - } - x - } if(!is.list(DATA)) stop("DATA must be a named list or data frame.") dlnames <- names(DATA) @@ -219,4 +170,60 @@ invisible(0) } + +toSingleS4 = +# +# Takes numeric vector and removes digit of exponent in scientific notation (if any) +# +# Written by Terry Elrod. Disclaimer: This function is used at the user's own risk. +# Please send comments to Ter...@UA.... +# Revision history: 2002-11-19. Fixed to handle missing values properly. +function(x) +{ + xdim <- dim(x) + x <- as.character(as.single(x)) + + # First to look for positives: + pplus <- regMatchPos(x, "e\\+0") + pplusind <- apply(pplus, 1, function(y) + (!any(is.na(y)))) + if(any(pplusind)) { + # Making sure that periods are in mantissa... + init <- substring(x[pplusind], 1, pplus[ + pplusind, 1] - 1) + #...preceeding exponent + pper <- regMatchPos(init, "\\.") + pperind <- apply(pper, 1, function(y) + (all(is.na(y)))) + if(any(pperind)) + init[pperind] <- paste(init[pperind], + ".0", sep = "") + # Changing the format of the exponent... + x[pplusind] <- paste(init, "E+", substring( + x[pplusind], pplus[pplusind, 2] + 1), + sep = "") + } + # Then to look for negatives: + pminus <- regMatchPos(x, "e\\-0") + pminusind <- apply(pminus, 1, function(y) + (!any(is.na(y)))) + if(any(pminusind)) { + # Making sure that periods are in mantissa... + init <- substring(x[pminusind], 1, pminus[ + pminusind, 1] - 1) + #...preceeding exponent + pper <- regMatchPos(init, "\\.") + pperind <- apply(pper, 1, function(y) + (all(is.na(y)))) + if(any(pperind)) + init[pperind] <- paste(init[pperind], + ".0", sep = "") + # Changing the format of the exponent... + x[pminusind] <- paste(init, "E-", substring( + x[pminusind], pminus[pminusind, 2] + + 1), sep = "") + } + x +} + } # ends if (!is.R()) Modified: trunk/R2WinBUGS/R/write.model.R =================================================================== --- trunk/R2WinBUGS/R/write.model.R 2007-05-08 21:50:38 UTC (rev 13) +++ trunk/R2WinBUGS/R/write.model.R 2007-05-08 21:58:37 UTC (rev 14) @@ -10,5 +10,48 @@ model.text <- paste("model", model.text) } model.text <- gsub("%_%", "", model.text) + if (!is.R()){ + ## In S-PLUS, scientific notation is different than it is in WinBUGS. + ## Change the format of any numbers in scientific notation. + model.text <- replaceScientificNotation(model.text) + + ## remove the "invisible()" line. + model.text <- gsub("invisible[ ]*\\([ ]*\\)", "", model.text) + } writeLines(model.text, con = con) } + +if (!is.R()){ + +replaceScientificNotation <- function(text){ +## Change the format of any numbers in "text" that are in S-PLUS +## scientific notation to WinBUGS scientific notation + + ## First, handle the positive exponents + ## Find the first instance + ## Note that the number may or may not have a decimal point. + sciNoteLoc <- regexpr("[0-9]*\\.{0,1}[0-9]*e\\+0[0-9]{2}", text) + + ## For every instance, replace the number + while(sciNoteLoc > -1){ + sciNoteEnd <- sciNoteLoc + attr(sciNoteLoc, "match.length")-1 + sciNote <- substring(text, sciNoteLoc, sciNoteEnd) + text <- gsub(sciNote, toSingleS4(sciNote), text) + sciNoteLoc <- regexpr("[0-9]*\\.{0,1}[0-9]*e\\+0[0-9]{2}", text) + } + + ## Then, handle the negative exponents + ## Find the first instance + sciNoteLoc <- regexpr("[0-9]*.{0,1}[0-9]*e\\-0[0-9]{2}", text) + + ## For every instance, replace the number + while(sciNoteLoc > -1){ + sciNoteEnd <- sciNoteLoc + attr(sciNoteLoc, "match.length")-1 + sciNote <- substring(text, sciNoteLoc, sciNoteEnd) + text <- gsub(sciNote, toSingleS4(sciNote), text) + sciNoteLoc <- regexpr("[0-9]*\\.{0,1}[0-9]*e\\-0[0-9]{2}", text) + } + + text +} +} ## ends if (!is.R()) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |