text: user10179: I was wondering if there is more elegant way of installing and loading multiple packages in Bioconductor similar to pacman with CRAN packages.
  I tried:
  
  # install and load  the package  manager
   if (!requireNamespace("BiocManager", quietly = TRUE))
      install.packages("BiocManager")
  
  # install and load bioconductor packages 
  bio_pkgs = c("BiocManager", "ggbio", "biomaRt", "EnsDb.Hsapiens.v75", "cBioPortalData", "GenomicRanges", "GenomicFeatures", "TxDb.Hsapiens.UCSC.hg19.knownGene", "Homo.sapiens")
  
   if (!requireNamespace(bio_pkgs, quietly = TRUE))
      BiocManager::install(bio_pkgs)
  
  library(easypackages)
  libraries("ggbio", "biomaRt", "EnsDb.Hsapiens.v75", "renvcBioPortalData", "GenomicRanges", "GenomicFeatures", "TxDb.Hsapiens.UCSC.hg19.knownGene", "Homo.sapiens")
  
  
  
  user-1: You can do something like this:
  bio_pkgs <- c("ggbio", "biomaRt", "EnsDb.Hsapiens.v75", "renvcBioPortalData", 
            "GenomicRanges", "GenomicFeatures", "TxDb.Hsapiens.UCSC.hg19.knownGene", "Homo.sapiens")
  
  # install:
  BiocManager::install(bio_pkgs)
  
  # load all at once
  invisible(lapply(pkgs, function(x) library(x, character.only=TRUE)))
  
  Be aware though that if you version-control your packages with something like renv then it is encouraged to explicitely load every package as suggested here so renv can properly recognize the packages to snapshot.
  
original_text: 10179: <p>I was wondering if there is more elegant way of installing and loading multiple packages in Bioconductor similar to <code>pacman</code> with CRAN packages.</p>
  <p>I tried:</p>
  <pre><code>
  # install and load  the package  manager
   if (!requireNamespace(&quot;BiocManager&quot;, quietly = TRUE))
      install.packages(&quot;BiocManager&quot;)
  
  # install and load bioconductor packages 
  bio_pkgs = c(&quot;BiocManager&quot;, &quot;ggbio&quot;, &quot;biomaRt&quot;, &quot;EnsDb.Hsapiens.v75&quot;, &quot;cBioPortalData&quot;, &quot;GenomicRanges&quot;, &quot;GenomicFeatures&quot;, &quot;TxDb.Hsapiens.UCSC.hg19.knownGene&quot;, &quot;Homo.sapiens&quot;)
  
   if (!requireNamespace(bio_pkgs, quietly = TRUE))
      BiocManager::install(bio_pkgs)
  
  library(easypackages)
  libraries(&quot;ggbio&quot;, &quot;biomaRt&quot;, &quot;EnsDb.Hsapiens.v75&quot;, &quot;renvcBioPortalData&quot;, &quot;GenomicRanges&quot;, &quot;GenomicFeatures&quot;, &quot;TxDb.Hsapiens.UCSC.hg19.knownGene&quot;, &quot;Homo.sapiens&quot;)
  
  </code></pre>
   -1: <p>You can do something like this:</p>
  <pre><code>bio_pkgs &lt;- c(&quot;ggbio&quot;, &quot;biomaRt&quot;, &quot;EnsDb.Hsapiens.v75&quot;, &quot;renvcBioPortalData&quot;, 
            &quot;GenomicRanges&quot;, &quot;GenomicFeatures&quot;, &quot;TxDb.Hsapiens.UCSC.hg19.knownGene&quot;, &quot;Homo.sapiens&quot;)
  
  # install:
  BiocManager::install(bio_pkgs)
  
  # load all at once
  invisible(lapply(pkgs, function(x) library(x, character.only=TRUE)))
  </code></pre>
  <p>Be aware though that if you version-control your packages with something like <code>renv</code> then it is encouraged to explicitely load every package as suggested <a href="https://github.com/rstudio/renv/issues/720" rel="nofollow noreferrer">here</a> so <code>renv</code> can properly recognize the packages to snapshot.</p>
  