Hi, I am trying to output a R data set for use in WinBugs, I used dput(list(x=rnorm(100),N=100),file="bug.dat") But I can't get the intended format: list(x=c(.......),N=100), instead, I got something like this (copied the first two lines): [00000000]???73?74?72?75??63?74?75?72??65?28?6C?69??73?74?28?78???? structure(list(x [00000010]???20?3D?20?63??28?2D?30?2E??33?36?33?31??36?31?30?33 ?????=?c(-0.36316103 Did I do something wrong here ? Thanks a lot for any help tong
Try control=NULL :> dput(list(x=rnorm(3),N=3), control = NULL)list(x = c(-0.254393363810571, -0.650328028909466, -1.20888767858120 ), N = 3) On 2/2/07, Tong Wang <wangtong at usc.edu> wrote:> Hi, > I am trying to output a R data set for use in WinBugs, I used > dput(list(x=rnorm(100),N=100),file="bug.dat") > But I can't get the intended format: list(x=c(.......),N=100), instead, I got > something like this (copied the first two lines): > > [00000000]???73?74?72?75??63?74?75?72??65?28?6C?69??73?74?28?78???? structure(list(x > [00000010]???20?3D?20?63??28?2D?30?2E??33?36?33?31??36?31?30?33 ?????=?c(-0.36316103 > > Did I do something wrong here ? Thanks a lot for any help > > tong > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
Have you looked at the BRugs and R2WinBUGS packages? They have functions for automatically converting R lists and other objects into WinBugs files (you can even run winbugs from within R). Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.snow at intermountainmail.org (801) 408-8111> -----Original Message----- > From: r-help-bounces at stat.math.ethz.ch > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Tong Wang > Sent: Friday, February 02, 2007 12:38 AM > To: R help > Subject: [R] A question about dput > > Hi, > I am trying to output a R data set for use in WinBugs, I used > dput(list(x=rnorm(100),N=100),file="bug.dat") > But I can't get the intended format: > list(x=c(.......),N=100), instead, I got > something like this (copied the first two lines): > > [00000000]???73?74?72?75??63?74?75?72??65?28?6C?69??73?74?28?7 > 8???? structure(list(x > [00000010]???20?3D?20?63??28?2D?30?2E??33?36?33?31??36?31?30?3 > 3 ?????=?c(-0.36316103 > > Did I do something wrong here ? Thanks a lot for any help > > tong > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >