[R] Examples on how to READ/WRITE to database using R-Project

Venkatesh Mantha venkatesh.mantha at pluralsoft.com
Wed Feb 21 16:43:34 CET 2007


Thanks very much for your reply. We am new to "R" and actually my main
interest is making sure that we can develop a R script that can efficiently
read/write to the database. Today we generate text files from the database,
run R in batch mode on these files and load the text files back into the
database. Even though this process works, given the amount of data we expect
to have and the forecasting results we expect to see this could be very time
consuming.

Our goal is to eliminate this additional I/O of reading/writing to files and
would like to read/write from/to the database in order to save time and have
a better process architecture.

I did read the manual and couldn't make much out of it. I was looking to see
if somebody has already done this so that I could use that to Jump start our
project.

Regards,

- Venkatesh Mantha

-----Original Message-----
From: Robert Baer [mailto:rbaer at atsu.edu] 
Sent: Wednesday, February 21, 2007 10:34 AM
To: Venkatesh Mantha; r-help at stat.math.ethz.ch
Subject: Re: [R] Examples on how to READ/WRITE to database using R-Project


> We are working on a project on forecast modeling and would like to know if
> there are any examples on how to READ/WRITE to a database (e.g. 
> PostgreSQL)
> using R-Project. I do have a sample R Script which takes input as files 
> from
> a directory and writes back output files to a directory.  I would like to
> convert this script to read from a database and write back the output to 
> a
> database.
> - Venkatesh Mantha
You probably want to install the RODBC package.  Then,
library(RODBC)
?RODBC

Also, the the relational database section of the R Data Import/Export Manual

is worth reading:
http://cran.r-project.org/doc/manuals/R-data.html



More information about the R-help mailing list