[BioC] R question on symbolic variables

axel.klenk at actelion.com axel.klenk at actelion.com
Thu Jan 14 10:40:35 CET 2010


Dear Chris,

the latter. I think you want:

a <- list(hello = c(1,2,3), goodbye = c(1,2,3))
b <- "hello"
a[b]
a[[b]]

Note the difference between extracting a sublist
using '[' and a list element using '[[' and see:

?"["

Cheers,

 - axel



Axel Klenk
Research Informatician
Actelion Pharmaceuticals Ltd / Gewerbestrasse 16 / CH-4123 Allschwil /
Switzerland



                                                                           
             Chris Fenton                                                  
             <chrisf at fagmed.ui                                             
             t.no>                                                      To 
             Sent by:                  bioconductor                        
             bioconductor-boun         <bioconductor at stat.math.ethz.ch>    
             ces at stat.math.eth                                          cc 
             z.ch                                                          
                                                                   Subject 
                                       [BioC] R question on symbolic       
             01/14/2010 09:54          variables                           
             AM                                                            
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




Is this a limitation in the R language or am I missing something
fundamental (like an operator)

> a <- list("hello"<-c(1,2,3), "goodbye"<-c(1,2,3))
> a$hello
[1] 1 2 3

> b <- "hello"
> a$b
NULL


So how could we do the following for example.

> info <- names(a)
> for (i in 1:length(info)){cat(a$info[i]);}


Chris

_______________________________________________
Bioconductor mailing list
Bioconductor at stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/bioconductor
Search the archives:
http://news.gmane.org/gmane.science.biology.informatics.conductor




The information of this email and in any file transmitted with it is strictly confidential and may be legally privileged.
It is intended solely for the addressee. If you are not the intended recipient, any copying, distribution or any other use of this email is prohibited and may be unlawful. In such case, you should please notify the sender immediately and destroy this email.
The content of this email is not legally binding unless confirmed by letter.
Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorised to state them to be the views of the sender's company. For further information about Actelion please see our website at http://www.actelion.com



More information about the Bioconductor mailing list