[R] combining data from different datasets

Dr Eberhard W Lisse el at lisse.na
Fri Oct 24 17:01:47 CEST 2008


Hi,

I have two tables:


 > iso
     continent code code3 codenum                          country
1          EU   AD   AND      20         Andorra, Principality of
2          AS   AE   ARE     784             United Arab Emirates
3          AS   AF   AFG       4 Afghanistan, Islamic Republic of
4          NA   AG   ATG      28              Antigua and Barbuda
5          NA   AI   AIA     660                         Anguilla
159        AF   NA   NAM     516             Namibia, Republic of
...
246        AF   ZW   ZWE     716            Zimbabwe, Republic of



and

 > rawdata
    idno alter  sex cctld capacity topics content speakers
1     1    NA    M    AD        A      2       1        2
2     2    52    M  <NA>        A      3       2        2
3     3    39    F    NA        T      2       2        2
...

How do I make it print out something like

	alter	sex	country
1	NA	M	Andorra, Principality of
2	39	F	Namibia, Republic of
...

in other words do something like the following SQL:

SELECT r.alter, r.sex, i.country
FROM iso i, rawdata r
WHERE i.code = r.cctld

or even better:

	alter	sex	country
1	NA	M	Andorra, Principality of
2	52	M	<NA>
3	39	F	Namibia
...

And idea (where I can read up on this)?


el
--
Dr. Eberhard W. Lisse  \        / Obstetrician & Gynaecologist (Saar)
el at lisse.NA el108-ARIN /   *   |   Telephone: +264 81 124 6733 (cell)
PO Box 8421             \     / Please send DNS/NA-NiC related e-mail
Bachbrecht, Namibia     ;____/             to dns-admin at na-nic.com.na



More information about the R-help mailing list