An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090423/7650f1de/attachment-0001.pl>
Load a data from oracle database to R
2 messages · Gagan Pabla, Marc Schwartz
On Apr 23, 2009, at 12:18 PM, Gagan Pabla wrote:
Hello, I am have trying to load data in R by connecting R to the database the following way:
library(RODBC)
channel<-odbcConnect("gagan")
now after I connect to the server by putting pwd. I want to load table from the database named "temp" in to R so that I can do some descriptive statistics with it. now when I try to do "data(temp)" it gives error saying "In data(temp) : data set 'temp' not found". So, how do I load the table to R. Your help will be greatly appreciated. Thanks, Gagan
Once you have established the connection to the Oracle server, you then need to perform a query against the database to get the data into R. So something like the following: temp <- sqlQuery(channel, "select * from temp") close(channel) Now you will have a data frame in R called temp. See ?sqlQuery after loading RODBC. BTW, there is a r-sig-db list. More info here: https://stat.ethz.ch/mailman/listinfo/r-sig-db HTH, Marc Schwartz