[R] solution for reading access tables into R
Wensui Liu
liuwensui at gmail.com
Wed Sep 29 21:41:54 CEST 2004
Thanks for the response from Thomas Lumley. There is the way to read
access tables into R, just for someone else who might be interested.
#######################################################
f>or instance, if
>there is a table named patient in the access file named patient_data
>in my C drive.
You need to set up a DSN for the file using the ODBC program in the
Control Panel. This is the name ODBC uses for your database. Suppose you
call it "patientdb"
Now
library(RODBC)
channel <- odbcConnect("patientdb")
to connect to the database
sqlTables(channel)
to list the available tables
sqlFetch(channel, "patient")
to fetch the table called "patient"
odbcClose(channel)
to close the connection.
More information about the R-help
mailing list