[R] A Simple Question

Ben Bolker bolker at ufl.edu
Wed Sep 17 21:34:13 CEST 2008


Gao, Aijun <Aijun.Gao <at> i3statprobe.com> writes:

> 
> 
> Hi:
> 
> I am trying to run your SCHOOLS example as following and I get an error
message stated that : Error: could not
> find function "bugs"
> Would you please help me since I would like to run some WINBUG programs from
your R by reading external data
> and I am new to R?
> Do I missing some function?  Should I install some extra files?
> 
> Thanks a lot in advance for your help!!
> 
> >  schools <- read.table ("schools.dat", header=TRUE)
> >    J <- nrow(schools)
> >    y <- schools$estimate
> >    sigma.y <- schools$sd
> >    data <- list ("J", "y", "sigma.y")
> >    inits <- function() {list (theta=rnorm(J,0,100), mu.theta=rnorm(1,0,100),
sigma.theta=runif(1,0,100))}
> >    parameters <- c("theta", "mu.theta", "sigma.theta")
> >   
 schools.sim <- bugs (data, inits, parameters, "schools.bug", n.chains=3,
n.iter=1000)
> Error: could not find function "bugs"

  I think you need 

library(R2WinBUGS)

before you try to run the bugs command

this is all assuming that you have WinBUGS installed ...

  Ben Bolker



More information about the R-help mailing list