[BioC] how to match tables

Sean Davis sdavis2 at mail.nih.gov
Mon Jul 14 22:09:32 CEST 2008


On Mon, Jul 14, 2008 at 3:32 PM, Dr Balazs Gyorffy <zsalab2 at yahoo.com> wrote:
> Hi All,
>
> This would be extremely easy in Access, but should be manageable in R too :-)
>
> I have two tables, which are the annotation files for two platforms. I have one common identifier, the "probenames", which is used in both tables. I would like combine table 1 and table 2 into table 3. The "match" is not good, since it gives only the first match. I have multiple entries in table 2, but only singe entries in table 1. Table 2 has only 2 columns, but table 1 has several. Some of the entries in table 1 do not have a matched enrty in table 2.
>
> Example:
>
> Table 1:
>  probename      gene    value
> 1       1007_s_at       geneX   valueX
> 2       1012_s_at       geneY   valueY
> 3       1117_s_at       geneZ   valueZ
>
> Table2:
>  probename      description
> 1       1012_s_at       something1
> 2       1012_s_at       something2
> 3       1117_s_at       something3
> 4       1117_s_at       something4
>
> Table 3 should be:
>  probename      gene    value   description
> 1       1007_s_at       geneX   valueX  NA
> 2       1012_s_at       geneY   valueY  something1
> 3       1012_s_at       geneY   valueY  something2
> 4       1117_s_at       geneZ   valueZ  something3
> 5       1117_s_at       geneZ   valueZ  something4

Hi, Balazs.  See the merge() function.

Sean



More information about the Bioconductor mailing list