[R] SQL Primer for R

ivo welch ivowel at gmail.com
Mon Aug 25 15:12:59 CEST 2008


Dear R wizards:

I decided to take the advice in the R data import/export manual and
want to learn how to work with SQL for large data sets.  I am trying
SQLite with the DBI and RSQLite database interfaces.  Speed is nice.
Alas, I am struggling to find a tutorial that is geared for the kind
of standard operations that I would want in R.  Simple things:

*  how to determine the number of rows in a table.  (Of course, I
could select a row of data and then use this.)

*  how to insert a new column into my existing SQL table---say, the
rank of another variable---and save it back.  Am I supposed to create
a new data frame, then save it as a new table, then delete the old SQL
table?

*  how to save a revised version of my table in a different sort order
 (with or without deleting the original table).  <-- I guess this is
not appropriate, as I should think of SQL tables as unordered.

I guess these would make nice little text snippets in the R Data
import/export manual, too.  help appreciated.

regards,

/ivo



More information about the R-help mailing list