safelyLoadAPackageInCRANorBioconductor: Load a package and install it if it is not installed using...

Description Usage Arguments Details Examples

View source: R/myBasicFunctions.R

Description

Load a package and install it if it is not installed using CRAN or Bioconductor.

Usage

1
2
3
4
safelyLoadAPackageInCRANorBioconductor(
  myPackage,
  cranRep = "https://stat.ethz.ch/CRAN/"
)

Arguments

myPackage

a string with the name of your package

cranRep

the repository you want to use, by default it is the Swiss one.

Details

It will try to load the package with the function require quietly=T. If the package is not installed, it will check if it is in CRAN. If it is not it will use BiocManager if the version of R is above 3.5.0 Or use biocLite if the version is bellow.

Examples

1
2
3
4
# With a bioconductor
safelyLoadAPackageInCRANorBioconductor("GenomicRanges")
# With a CRAN
safelyLoadAPackageInCRANorBioconductor("UpSetR")

lldelisle/usefulLDfunctions documentation built on Nov. 29, 2021, 5:40 a.m.