[R] R is not for Relational

Prof Brian D Ripley ripley at stats.ox.ac.uk
Wed Aug 4 08:44:53 CEST 1999

On Tue, 3 Aug 1999, Robert Gentleman wrote:

> On Tue, Aug 03, 1999 at 10:44:17PM +0200, Peter Dalgaard BSA wrote:
> > Russell Senior <seniorr at teleport.com> writes:
> > 
> > > Peter> Check if subset() does something in the right direction. What
> > > Peter> would the select statement do, precisely? (I don't speak SQL)
> > > 
> > > One useful thing that subset() doesn't appear to do is joins.  That is
> > > frequently what select statements are used for in SQL.  There are
> > > three S-plus functions (at least, as documented in MASS 2ed) called
> > > merge, by and aggregate.  The merge() function joins data frames, but
> > > is not implemented in R that I am aware of, at least as of 0.64.0.
> > 
> > Hmm. What does the SQL syntax (and semantics) look like for that kind
> > of operation? Would it make sense to try and turn the existing
> > subset() into a select() function which could do joins as well?
> > 
> Join in SQL parlance is a way to join two (or more tables).
> A very simple example is:
>   If we imagine that TABX has the X variables and TABY has the Y ones
> then the result should be a table with 4 columns, XX and XY from TABX,
>  YX and YY from TABY. It will have one row for each XG that matches
> an element in YG.

>   I think that Splus's merge does something a bit different but I
> can't be sure without trying it out.

It is almost exactly that: it will have a column giving the names of the
XGs that matched.

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list