[R] R is not for Relational

John Carter john at dwaf-hri.pwv.gov.za
Wed Aug 4 08:28:58 CEST 1999


The full syntax of the SQL select statement (courtesy of postgres SQL
documentation) is this monster....

SELECT [ALL|DISTINCT]
    expression [AS name] [, ...]
    [INTO [TABLE] intable]
    [FROM table [alias] [, ...] ]
    [WHERE condition]
    [GROUP BY column [, ...] ]
    [HAVING condition [, ...] ]
    [UNION [ALL] select]
    [ORDER BY column [ASC | DESC] [, ...] ]

Which is an omnibus does all and everything horrible monster.

I could use the mSql package, but that would defeat my attempt to hand
over this current project to Windows only users.

Thanks to Peter, I see that "subset()" does indeed correspond to a
relational row and column project operator. 

The piece that is still missing is a join. (I wrote a nice
implementation of equijoin in perl, it uses hashes and is a lot faster
than postgres-sql. (Does R have perl-like hashes lurking somewhere?))

Join shouldn't be too difficult to write, but if S's "merge" is really a
join by a different name, perhaps it would be best to copy its syntax.

Join's are trivial, extended cartesian product followed by a
"subset()". Unfortunately efficient join's are hairy, using simplistic
algorithm you start with an nxm table and a pxq table and have an
often unmanageably huge (n*p)x(m+q) intermediate table.

Does anyone have the "help" file for "merge()" anywhere?

John Carter                    EMail: ece at dwaf-hri.pwv.gov.za
Telephone : 27-12-808-0374x194 Fax:- 27-12-808-0338
 or 

When I grow up, I'm going to be a range of mountains!


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