Bayesian Network with R

The packagesgraph, RBGL and Rgraphviz are not on CRAN but on bioconductor.

To install these packages, execute

if (!requireNamespace("BiocManager", quietly = TRUE))
    install.packages("BiocManager")
BiocManager::install(c("graph", "RBGL", "Rgraphviz"))

Then install the packages from CRAN in the usual way:

install.packages("gRain", dependencies=TRUE)

See also the gRain installation instructions.


For R version 3.5 or greater, you can install Bioconductor packages using BiocManager.
Please see: https://bioconductor.org/install.
I installed them using the following code:

if (!requireNamespace("BiocManager", quietly = TRUE))
    install.packages("BiocManager")
BiocManager::install(version = "3.10")
BiocManager::install(c("gRbase", "RBGL", "Rgraphviz", "gRain"))