I am wondering if there is a nice way to check of a package belongs to Bioconductor (because the installation is different than R CRAN package.
For example, I want to do something like that:
libraries <- c("ggplot2","BioBase")
check.libraries <- is.element(libraries, installed.packages()[, 1])==FALSE
libraries.to.install <- libraries[check.libraries]
if (length(libraries.to.install!=0)) {
install.packages(libraries.to.install)
}
success <- sapply(libraries,require, quietly = FALSE, character.only = TRUE)
if(length(success) != length(libraries)) {stop("A package failed to return a success in require() function.")}
This piece of code, checks if the libraries are installed if not are installed. But since Bioconductor Packages are installed in a different way, i.e: Biocmanager::install("Biobase") I want to do a condition. I checked for BiocCheck But I think it does not do the work.