Hello,
I have problem with last version of R and rpy classic, so i try to convert
my source code into rpy2, but i have problem to understand with calling
function into a function

Exemple with my db connection :
*
With rpy classic, it's ok : *

rpy.set_default_mode(rpy.NO_CONVERSION)
r('conn <- dbConnect(PgSQL(), host="localhost", dbname="simpop",
user="postgres", password="postgres")')
*
With rpy2, error :*

import rpy2.robjects as robjects
import sys
import math

r = robjects.r

r.library("Rdbi")
r.library("RdbiPgSQL")
r.library("ggplot2")

#Connect to DB with RPY2
rconn = r.dbConnect
bdobj = r.PgSQL

print bdobj

conn = rconn( bdobj, host="localhost", dbname="simpop", user="postgres",
password="postgres")
*
At execution : *

function ()
{
    out <- list(description = "PostgreSQL object")
    class(out) <- c("PgSQL", "Rdbi")
    return(out)
}
<environment: namespace:RdbiPgSQL>
Error in dbConnect.default(function ()  : Invalid database class
Traceback (most recent call last):
  File "s_ranktail_resume_rpy2.py", line 19, in <module>
    conn = rconn( bdobj, host="localhost", dbname="simpop", user="postgres",
password="postgres")
  File "/usr/lib/python2.5/site-packages/rpy2/robjects/__init__.py", line
422, in __call__
    res = super(RFunction, self).__call__(*new_args, **new_kwargs)
rinterface.RRuntimeError: Error in dbConnect.default(function ()  : Invalid
database class

I don't understand where is the problem ?

Thx a lot with a newbie on python/R/Rpy2
Seb
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have 
the opportunity to enter the BlackBerry Developer Challenge. See full prize 
details at: http://p.sf.net/sfu/blackberry
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to