nutterb / HydeNet

Hybrid Decision Networks in R
Other
23 stars 3 forks source link

compileJagsModel data argument woes #67

Closed jarrod-dalton closed 9 years ago

jarrod-dalton commented 9 years ago

I don't know if my tweaks to compileJagsModel() caused this, but I'm getting an error message in the line that calls jags.model():

library(HydeNet)

mtcars2 <- transform(mtcars,
                     cyl = factor(cyl),
                     gear=factor(gear),
                     am = factor(am))

carNet <- HydeNetwork(~ cyl
                      + disp | cyl
                      + hp | disp
                      + wt
                      + gear
                      + mpg | disp*hp*wt*gear,
                      data=mtcars2)

writeNetworkModel(carNet, pretty = TRUE)

carNet1 <- compileJagsModel(carNet)
Error in rjags::jags.model(textConnection(writeNetworkModel(network)),  : 
  data must be a list or environment
jarrod-dalton commented 9 years ago

My latest commit seems to work, but should be reviewed (or at least paid attention to in case new bugs pop up).

nutterb commented 9 years ago

Looks good to me. I'll keep an eye out for it if anything goes weird.