[R] R is not for Relational
Robert Gentleman
rgentlem at jimmy.harvard.edu
Tue Aug 3 23:03:34 CEST 1999
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:
SELECT XX, XY, YX, YY
FROM TABX, TABY
WHERE XG = YG
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.
This is of course a very simple example; (they seem to call it an
equi-join in some circles) and things can get a lot more complicated.
+-------------------------------------------------------------------------+
| Robert Gentleman voice: (617) 632-5045 |
| Senior Lecturer fax: (617) 632-2444 |
| University of Auckland email1: rgentlem at jimmy.harvard.edu |
| on leave at: |
| Dana-Farber Cancer Institute email2: rgentlem at stat.auckland.ac.nz |
+-------------------------------------------------------------------------+
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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