Hello All,
So I am trying to completely automate my pipeline. I am to have a bunch of R scripts in the background and then just one script a user can interact with that has a bunch of functions. Naturally I want the package loading to be a part of this. I tried to create the following function but it does not work. It will try to run the code in the function automatically without making it. The idea is if the user selects 1 it will install and load the packages, otherwise just load them. Any ideas?
loadpackages <- function(x)
{
if (x = 1) {
source("http://bioconductor.org/biocLite.R")
biocLite("oligo")
biocLite("limma")
biocLite("pd.hugene.2.1.st")
biocLite("hugene20sttranscriptcluster.db")
biocLite("genefilter")
biocLite("annotate")
library(limma)
library(oligo)
librarypd.hugene.2.0.st)
library(genefilter)
library(annotate)
library(hugene20sttranscriptcluster.db)
}
else {
library(limma)
library(oligo)
librarypd.hugene.2.0.st)
library(genefilter)
library(annotate)
library(hugene20sttranscriptcluster.db)
}
}
isn't it
x == 1
for a comparative operator?Opps...well that was embarrassing. I did not notice that.
Why not just have a directory containing the libraries? We do that for some of our pipelines so people don't have to bother installing all of the packages themselves.
I tried doing that using packrat and it did not work for me. There were a few errors. I suppose I can do it manually?