Entering edit mode
9.1 years ago
bioinforupesh2009.au
▴
140
Dear folks,
I am wondering how to stop my further script if required packages are not loaded properly? Somehow packages are installed but while loading its failed and gives error. However, my script run further but its fail when he found function of that unloaded package. I felt, because of dependencies of that packages not installed properly.
My function to install pkgs:
# load multiple packages by once but first to check if installed?
pkgs= c("A", "B","C","D")
# Install packages if not already installed
inst_bio <- pkgs %in% installed.packages()
if(length(pkgs[!inst_bio]) > 0)
{
source("http://bioconductor.org/biocLite.R") ## online use
suppressWarnings(suppressMessages(lapply(pkgs[!inst_bio], biocLite, dependencies = T,suppressUpdates=T,ask=F,suppressAutoUpdate=T)))
}
## Load packages into session
suppressWarnings(suppressMessages(lapply(pkgs, require, character.only=T)))
Error : object ålatticeGrobå is not exported by 'namespace:gridExtra'
[[1]]
[1] TRUE
[[2]]
[1] TRUE
[[3]]
[1] FALSE
[[4]]
[1] TRUE
Then I tried manually to install latticeGrob
Warning message:
package ålatticeGrobå is not available (for R version 3.1.3)
So, my question is, how to stop running script if packages are not loaded properly into session?
Thank you
I would rather ask the question how to make this work rather than asking how to make it fail early :)
latticeGrob isn't a package but part of the ggbio package. You seem to have some broken dependencies. It could be because some packages haven't been built for your system. First identify the package with the broken dependencies then try a different versions to see if that works.
Thank you but I need this solution. what I asked. its my pipeline script.
..I don't know how to find old version of bioconductor packages.
leave it, its done. I made it by myself.
Thank you by the way
Since you seem to have gotten the answer, could you post it here so that folks who have a similar question can learn what you did?