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
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.