Loading library with name in a variable
0
0
Entering edit mode
@patrick-schorderet-6081
Last seen 9.5 years ago
United States

Dear all,

 

I am trying to load a database, which name is in a variable (I actually ask the user to provide the name of the database he needs). Does any body know if this is even possible??

TaxonDatabaseKG <- "TxDb.Mmusculus.UCSC.mm10.knownGene"

TaxonDatabaseKG
[1] "TxDb.Mmusculus.UCSC.mm10.knownGene"

library(TaxonDatabaseKG)        # I'd like this to be similar as library(TxDb.Mmusculus.UCSC.mm10.knownGene)

 

I keep getting an error message:

Error in library(TaxonDatabaseKG) :  there is no package called ‘TaxonDatabaseKG’

 

Thanks for any help

 

 

 

 

> sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: x86_64-apple-darwin10.8.0 (64-bit)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
 [1] grid      parallel  stats4    stats     graphics  grDevices utils    
 [8] datasets  methods   base     

other attached packages:
 [1] VennDiagram_1.6.9       gtools_3.4.1            edgeR_3.8.5            
 [4] limma_3.22.1            GenomicAlignments_1.2.1 Rsamtools_1.18.2       
 [7] Biostrings_2.34.1       XVector_0.6.0           GenomicRanges_1.18.3   
[10] AnnotationDbi_1.28.1    GenomeInfoDb_1.2.3      IRanges_2.0.1          
[13] S4Vectors_0.4.0         Biobase_2.26.0          BiocGenerics_0.12.1    

loaded via a namespace (and not attached):
 [1] base64enc_0.1-2    BatchJobs_1.5      BBmisc_1.8         BiocParallel_1.0.0
 [5] bitops_1.0-6       brew_1.0-6         checkmate_1.5.0    codetools_0.2-9   
 [9] DBI_0.3.1          digest_0.6.4       fail_1.2           foreach_1.4.2     
[13] iterators_1.0.7    RSQLite_1.0.0      sendmailR_1.2-1    stringr_0.6.2     
[17] tools_3.1.2        zlibbioc_1.12.0   

 

 

library characters • 1.5k views
ADD COMMENT
0
Entering edit mode

ok, I got it: FYI:

library(...,character.only = TRUE)

And use get(...) to access it.

 

ADD REPLY

Login before adding your answer.

Traffic: 780 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6