[R] How to use SQL code in R

Emmanuel Charpentier emm.charpentier at free.fr
Mon Nov 16 08:45:11 CET 2009


Le lundi 16 novembre 2009 à 13:14 +0800, sdlywjl666 a écrit :
> Dear All,
>   How to use SQL code in R?

Depends on what you mean by "using SQL code in R"...

If you mean "Query, update or otherwise mess with an existing database",
look at the RODBC packages and/or various RDBI-related packages (hint :
look at BDR's nice manual on importing/exporting data in R which comes
with the standrd R documentation).

If you mean "use standard SQL code to manipilte R dataframes", look at
the sqldf ackage (quite nice, but be aware that is work in progress").

If you mean "use Oracle's command language or pgsql or ... in order to
transfer in R code written for a specific database", I'm afraid your
SOL... In that last case, however, note that you may be able to use R
*inside* your external database instead, depending on its ability to use
external code (I'm thinking of the rpgsql language, which allows running
R code in a pgsql function in PostgreSQL).

HTH,

					Emmanuel Charpentier

BTW, there exist a R database Special Interest Group, with a mailing
list. Lookup their archive, and maybe ask a (slightly less general, if
possible) version of your question there...




More information about the R-help mailing list