0

Plotting a Bayesian network with graphviz.chart produces the following error:

Error in check.label(layout, choices = graphviz.layouts, argname = "graph layout") :
object 'graphviz.layouts' not found

Code to reproduce:

library(bnlearn)
library(Rgraphviz)

modelstring = paste("[HIST|LVF][CVP|LVV][PCWP|LVV][HYP][LVV|HYP:LVF][LVF]",
                     "[STKV|HYP:LVF][ERLO][HRBP|ERLO:HR][HREK|ERCA:HR][ERCA][HRSA|ERCA:HR][ANES]",
                     "[APL][TPR|APL][ECO2|ACO2:VLNG][KINK][MINV|INT:VLNG][FIO2][PVS|FIO2:VALV]",
                     "[SAO2|PVS:SHNT][PAP|PMB][PMB][SHNT|INT:PMB][INT][PRSS|INT:KINK:VTUB][DISC]",
                     "[MVS][VMCH|MVS][VTUB|DISC:VMCH][VLNG|INT:KINK:VTUB][VALV|INT:VLNG][ACO2|VALV]",
                     "[CCHL|ACO2:ANES:SAO2:TPR][HR|CCHL][CO|HR:STKV][BP|CO:TPR]", sep = "")
dag = model2network(modelstring)
fitted = bn.fit(dag, alarm)
graphviz.chart(fitted, grid = TRUE, bg = "beige", bar.col = "black")

R sessionInfo

Noir
  • 1
  • 1
  • Hi, can you edit your question with the results of `sessionInfo()` please, after starting a new R session and loading Rgraphviz and bnlearn.. thanks – user20650 Sep 09 '22 at 18:14
  • added RsessionInfo picture, I have 4.7.1 bnlearn; first it says check.label() function is not found; I paste the code from the bnlearn source than it says there is a problem with graphviz.layouts – Noir Sep 12 '22 at 19:31
  • okay, thanks for updating your question (i've removed my close vote). I am not sure what is happening. I assumed that you were using an old version before `graphviz.chart` was implemented but your versions are up to date: I have the same package versions as you and works as expected. You can also see [`graphviz.layouts]`](https://github.com/cran/bnlearn/blob/d6a9701275a96a313e0d5132895eb29f286df18c/R/globals.R#L330) is defined in `bnlearn v4.7.1` . Can you try to install from source via github just in case you installed a binary that is in some way goosed? – user20650 Sep 12 '22 at 20:50
  • ... or actuall try to install from `install.packages("https://www.bnlearn.com/releases/bnlearn_latest.tar.gz", repos = NULL, type = "source")` – user20650 Sep 12 '22 at 20:56

0 Answers0