带 R 的贝叶斯网络
Bayesian Network with R
我正在尝试构建贝叶斯网络模型。但是我无法安装合适的软件包。已尝试 gRain
、bnlearn
和 Rgraphviz
进行绘图。我试过 R 2.15 和 3.2
以下是错误消息:
library(gRain)
Loading required package: gRbase
Loading required package: graph
Error: package ‘graph’ could not be loaded
In addition: Warning message:
In library(pkg, character.only = TRUE, logical.return = TRUE, lib.loc = lib.loc) :
there is no package called ‘graph’
> install.packages("graph")
Warning message:
package ‘graph’ is not available (for R version 2.15.3)
R 3.2.1 相同
> install.packages("graph")
(as ‘lib’ is unspecified)
Warning message:
package ‘graph’ is not available (for R version 3.2.1)
> install.packages("Rgraphviz")
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
Warning messages:
1: In open.connection(con, "r") : unable to resolve 'cran.r-project.org'
2: package ‘Rgraphviz’ is not available (for R version 3.2.1)
> install.packages("Rgraphviz")
(as ‘lib’ is unspecified)
Warning message:
package ‘Rgraphviz’ is not available (for R version 2.15.3)
模型的其他信息
1) 变量数 - 17
2) 变量类型 - discrete/continuous
软件包graph
、RBGL
和Rgraphviz
不在CRAN 上,而是在bioconductor 上。
要安装这些包,执行
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install(c("graph", "RBGL", "Rgraphviz"))
然后以通常的方式从 CRAN 安装软件包:
install.packages("gRain", dependencies=TRUE)
对于 R 3.5 或更高版本,您可以使用 BiocManager.
安装 Bioconductor 包
请参阅:https://bioconductor.org/install.
我使用以下代码安装了它们:
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install(version = "3.10")
BiocManager::install(c("gRbase", "RBGL", "Rgraphviz", "gRain"))
我正在尝试构建贝叶斯网络模型。但是我无法安装合适的软件包。已尝试 gRain
、bnlearn
和 Rgraphviz
进行绘图。我试过 R 2.15 和 3.2
以下是错误消息:
library(gRain)
Loading required package: gRbase
Loading required package: graph
Error: package ‘graph’ could not be loaded
In addition: Warning message:
In library(pkg, character.only = TRUE, logical.return = TRUE, lib.loc = lib.loc) :
there is no package called ‘graph’
> install.packages("graph")
Warning message:
package ‘graph’ is not available (for R version 2.15.3)
R 3.2.1 相同
> install.packages("graph")
(as ‘lib’ is unspecified)
Warning message:
package ‘graph’ is not available (for R version 3.2.1)
> install.packages("Rgraphviz")
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
Warning messages:
1: In open.connection(con, "r") : unable to resolve 'cran.r-project.org'
2: package ‘Rgraphviz’ is not available (for R version 3.2.1)
> install.packages("Rgraphviz")
(as ‘lib’ is unspecified)
Warning message:
package ‘Rgraphviz’ is not available (for R version 2.15.3)
模型的其他信息
1) 变量数 - 17 2) 变量类型 - discrete/continuous
软件包graph
、RBGL
和Rgraphviz
不在CRAN 上,而是在bioconductor 上。
要安装这些包,执行
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install(c("graph", "RBGL", "Rgraphviz"))
然后以通常的方式从 CRAN 安装软件包:
install.packages("gRain", dependencies=TRUE)
对于 R 3.5 或更高版本,您可以使用 BiocManager.
安装 Bioconductor 包
请参阅:https://bioconductor.org/install.
我使用以下代码安装了它们:
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install(version = "3.10")
BiocManager::install(c("gRbase", "RBGL", "Rgraphviz", "gRain"))