Gabor,

Thank you,

On 24 Oct 2008, at 17:16 , Gabor Grothendieck wrote:

Here are two solutions.  The first uses the R merge command
and the second uses the R sqldf package.  See ?merge
and http://sqldf.googlecode.com
Note that alter is an sql keyword so I have changed it
to alt for the second example:

merge(iso, rawdata)[c("alt", "sex", "country")]
 alter sex country
1    NA   M Andorra
2    39   F Namibia

merge(rawdata, iso, by.x = "cctld", by.y = "code", all.x = TRUE)
        [c("alter","sex", "cctld", "country")]

all.x = TRUE even pulls the cases with missing values


library(sqldf)

sqldf("select alt, sex, country from iso join rawdata using(country)")
 alt sex country
1  NA   M Andorra
2  39   F Namibia

This looks very cool.

But I must still make a plan with regards to country = "NA" (Namibia)
or continent = "NA" (North America)

But there are the vignettes.

el

______________________________________________
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.

Reply via email to