bnlearn is an R package for learning the graphical structure of Bayesian networks, estimate their parameters and perform some useful inference. It was first released in 2007, it has been under continuous development for more than 10 years (and still going strong). To get started and install the latest development snapshot type
install.packages("https://www.bnlearn.com/releases/bnlearn_latest.tar.gz", repos = NULL, type = "source")
in your R console. (More detailed installation instructions below.)
Downloads  

current release on CRAN:  
4.6.1  [ link ] 
latest snapshot + bugfixes:  
4.6.1  [ link ] 
From the R Studio CRAN Mirror:  

Research Impact:  
bnlearn implements the following constraintbased structure learning algorithms:
 PC (the stable version);
 GrowShrink (GS);
 Incremental Association Markov Blanket (IAMB);
 Fast Incremental Association (FastIAMB);
 Interleaved Incremental Association (InterIAMB);
 Incremental Association with FDR Correction (IAMBFDR);
 MaxMin Parents & Children (MMPC);
 SemiInterleaved HitonPC (SIHITONPC);
 Hybrid Parents & Children (HPC);
the following scorebased structure learning algorithms:
 Hill Climbing (HC);
 Tabu Search (Tabu);
the following hybrid structure learning algorithms:
 MaxMin Hill Climbing (MMHC);
 Hybrid HPC (H2PC);
 General 2Phase Restricted Maximization (RSMAX2);
the following local discovery algorithms:
 ChowLiu;
 ARACNE;
and the following Bayesian network classifiers:
 naive Bayes;
 TreeAugmented naive Bayes (TAN).
Discrete (multinomial) and continuous (multivariate normal) data sets are
supported, both for structure and parameter learning. The latter can be performed
using either maximum likelihood or Bayesian estimators.
Each constraintbased algorithm can be used with several conditional
independence tests:

categorical data (multinomial distribution):
 mutual information (parametric, semiparametric and permutation tests);
 shrinkageestimator for the mutual information;
 Pearson's X^{2} (parametric, semiparametric and permutation tests);

ordinal data:
 JonckheereTerpstra (parametric and permutation tests);

continuous data (multivariate normal distribution):
 linear correlation (parametric, semiparametric and permutation tests);
 Fisher's Z (parametric, semiparametric and permutation tests);
 mutual information (parametric, semiparametric and permutation tests);
 shrinkageestimator for the mutual information;

mixed data (conditional Gaussian distribution):
 mutual information (parametric, semiparametric);
and each scorebased algorithm can be used with several score functions:

categorical data (multinomial distribution):
 the multinomial loglikelihood;
 the Akaike Information Criterion (AIC);
 the Bayesian Information Criterion (BIC);
 the multinomial predictive loglikelihood;
 a score equivalent Dirichlet posterior density (BDe);
 a sparse Dirichlet posterior density (BDs);
 a Dirichlet posterior density based on Jeffrey's prior (BDJ);
 a modified Bayesian Dirichlet for mixtures of interventional and observational data;
 the locally averaged BDe score (BDla);
 the K2 score;

continuous data (multivariate normal distribution):
 the multivariate Gaussian loglikelihood;
 the corresponding Akaike Information Criterion (AIC);
 the corresponding Bayesian Information Criterion (BIC);
 the corresponding predictive loglikelihood;
 a score equivalent Gaussian posterior density (BGe);

mixed data (conditional Gaussian distribution):
 the conditional Gaussian loglikelihood;
 the corresponding Akaike Information Criterion (AIC);
 the corresponding Bayesian Information Criterion (BIC);
 the corresponding predictive loglikelihood.
Package installation
bnlearn is available on CRAN and can be downloaded from its web page in the Packages section (here). It can be installed with a simple:
install.packages("bnlearn")
Development snapshots, which include bugfixes that will be incorporated in the CRAN release as well as new features, can be downloaded from the links above or installed with a simple:
install.packages("http://www.bnlearn.com/releases/bnlearn_latest.tar.gz")
The only suggested packages not hosted on CRAN are graph and Rgraphviz, which can be installed from BioConductor:
if (!requireNamespace("BiocManager", quietly = TRUE)) install.packages("BiocManager") BiocManager::install() BiocManager::install(c("graph", "Rgraphviz"))
following the instructions present on this and this webpages. Please also note that the gRain package, while on CRAN, depends on packages that are on Bioconductor both directly and through the gRbase package, which depends on RBGL:
BiocManager::install() BiocManager::install(c("graph", "Rgraphviz", "RBGL")) install.packages("gRain")