An example is:

symbol=human[which(human[,3] %in% genes.sam.names),8]

The data* human* and *genes.sam.names* are attached. The result of the above
command is:
> symbol
 [1] CCL18                  MARCO                  SYT13
 [4] FOXC1                  CDH3
 [7] CA12                   CELSR1                 NM_018440
[10] MICROTUBULE-ASSOCIATED NM_015529              ESR1
[13] PHGDH                  GABRP                  LGMN
[16] MMP9                   BMP7                   KLF5
[19] RIPK2                  GATA3                  NM_032023
[22] TRIM2                  CCND1                  MMP12
[25] LDHB                   AF493978               SOD2
[28] SOD2                   SOD2                   NME5
[31] STC2                   RBP1                   ROPN1
[34] RDH10                  KRTHB1                 SLPI
[37] BBOX1                  FOXA1                  NM_005669
[40] MCCC2                  CHI3L1                 GSTM3
[43] LPIN1                  DSC2                   FADS2
[46] ELF5                   CYP1B1                 LMO4
[49] AL035297               NM_152398              AB018342
[52] PIK3R1                 NFKBIE                 MLZE
[55] NFIB                   NM_052997              NM_006023
[58] CPB1                   CXCL13                 CBR3
[61] NM_017527              FABP7                  DACH
[64] IFI27                  ACOX2                  CXCL11
[67] UGP2                   CLDN4                  M12740
[70] IGKC                   IGKC                   CLECSF12
[73] AY069977               HOXB2                  SOX11
[76]                        NM_017422              TLR2
[79] CKS1B                  BC017946               APOBEC3B
[82]                        HLA-DRB1               HLA-DQB1
[85]                        CCL13                  C4orf7
[88]                        NM_173552
21345 Levels:  (2 (32 (55.11 (AIB-1) (ALU (CAK1) (CAP4) (CASPASE ... ZYX

As you can see, apart from gene symbols, which is the required thing, RefSeq
ID sare also retrieved...

Thanks a lot,
Eleni






On Fri, Jun 6, 2008 at 1:23 PM, Dieter Menne <dieter.menne@menne-biomed.de>
wrote:

> Eleni Christodoulou <elenichri <at> gmail.com> writes:
>
> > I was trying to select a column of a data frame using the *which*
> command. I
> > was actually selecting the rows of the data frame using *which, *and then
> > displayed a certain column of it. The command that I was using is:
> > sequence=*mydata*[*which*(human[,3] %in% genes.sam.names),*9*]
> ....
> Please provide a running example. The *mydata* are difficult to read.
>
>
> Dieter
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]

