I'm using the dump command to pass data to WinBUGS/OpenBUGS/JAGS and have run into a problem. Here is some R-code: foo <- array(1:6, dim=c(2,3)) dump('foo', file='dumpdata.R') dump('foo', file='dumpdata.R', append=TRUE, evaluate=TRUE) foo2 <- array(c(2,3,5,7,9,7,5,3), dim=c(2,4)) dump('foo2', file='dumpdata.R', append=TRUE) And here is the file dumpdata.R: foo <- structure(1:6, .Dim = 2:3) foo <- structure(1:6, .Dim = 2:3) foo2 <- structure(c(2, 3, 5, 7, 9, 7, 5, 3), .Dim = c(2L, 4L)) Looking at the help page, the second dump of foo should look like the dump of foo2 because the evaluate=TRUE flag tells it to evaluate the promises. Unfortunately dump's control parameter didn't offer any solution, either. Am I missing anything? P.S. I've tried this on versions 2.11 and 2.9 and the results are the same. -- View this message in context: http://r.789695.n4.nabble.com/dump-not-evaluating-promises-tp2075859p2075859.html Sent from the R help mailing list archive at Nabble.com.
On 29/04/2010 12:45 PM, D Sonderegger wrote:> I'm using the dump command to pass data to WinBUGS/OpenBUGS/JAGS and have run > into a problem. > > Here is some R-code: > foo <- array(1:6, dim=c(2,3)) > dump('foo', file='dumpdata.R') > dump('foo', file='dumpdata.R', append=TRUE, evaluate=TRUE) > foo2 <- array(c(2,3,5,7,9,7,5,3), dim=c(2,4)) > dump('foo2', file='dumpdata.R', append=TRUE) > > And here is the file dumpdata.R: > foo <- > structure(1:6, .Dim = 2:3) > foo <- > structure(1:6, .Dim = 2:3) > foo2 <- > structure(c(2, 3, 5, 7, 9, 7, 5, 3), .Dim = c(2L, 4L)) > > > Looking at the help page, the second dump of foo should look like the dump > of foo2 because the evaluate=TRUE flag tells it to evaluate the promises. > Unfortunately dump's control parameter didn't offer any solution, either. > Am I missing anything? >I don't get it. Why would the second dump not show the values 1:6? How would it know about the vector or the new dimension that you put into foo2? I think you need to be more explicit about what output you were expecting, and why. Duncan Murdoch> P.S. I've tried this on versions 2.11 and 2.9 and the results are the same. > >
What I was expecting was for the second dump was: foo <- structure(c(1,2,3,4,5,6), .Dim = c(2L, 3L)) That is, I was expecting dump to expand the 1:6 and 2:3 into the actual vectors. -- View this message in context: http://r.789695.n4.nabble.com/dump-not-evaluating-promises-tp2075859p2076059.html Sent from the R help mailing list archive at Nabble.com.
D Sonderegger wrote:> What I was expecting was for the second dump was: > foo <- > structure(c(1,2,3,4,5,6), .Dim = c(2L, 3L)) > > That is, I was expecting dump to expand the 1:6 and 2:3 into the actual > vectors.Well,> dput(c(1,2,3))c(1, 2, 3)> dput(c(1L,2L,3L))1:3 And dump() does likewise. -- Peter Dalgaard Center for Statistics, Copenhagen Business School Phone: (+45)38153501 Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com