On Mon, Jun 15, 2009 at 4:15 PM, Xavier Tremblay<xavier.tremb...@polymtl.ca> wrote: > > Hello all, > > I tried to find my answer in the archives of this mailing list, on Google and > on > RPY website, but I've found nothing so far. So forgive me if this was already > asked or dumb question. > > I'm trying to load a data set from MASS library, birthwt with the following > code > > import rpy2.robjects as robjects > r = robjects.r > r.library('MASS') > r.attach('birthwt') > > However I have the following error : > > Error in function (what, pos = 2, name = deparse(substitute(what)), > warn.conflicts = TRUE) : > file 'birthwt' not found > Traceback (most recent call last): > File "/home/xatre/workspace/FrameWork/src/birth.py", line 10, in ? > r.attach('birthwt') > File "/usr/lib64/python2.4/site-packages/rpy2/robjects/__init__.py", line > 422, > in __call__ > res = super(RFunction, self).__call__(*new_args, **new_kwargs) > rinterface.RRuntimeError: Error in function (what, pos = 2, name = > deparse(substitute(what)), warn.conflicts = TRUE) : > file 'birthwt' not found > > It seems that my rpy2's "R instance" can't load or find the data set. Is this > a > known issue ? How can I make rpy2's "R instance" find it, because my R can > load it. Do I need to move my data set in my folder where my .py is lunched ?
I don't know how to fix this, but for what it is worth, the exact same error happens in rpy1: >>> import rpy >>> rpy.r.library("MASS") ['MASS', 'stats', 'graphics', 'grDevices', 'utils', 'datasets', 'methods', 'base'] >>> rpy.r.attach("birthwt") Traceback (most recent call last): File "<stdin>", line 1, in <module> rpy.RPy_RException: Error in function (what, pos = 2, name = deparse(substitute(what)), warn.conflicts = TRUE) : file 'birthwt' not found In the absence of any other suggestions, I would just not use attach and instead access the birthwt data explicitly by name. Of course, being more of a python programmer than an R programmer, I like to have things explicit ;) Peter ------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects _______________________________________________ rpy-list mailing list rpy-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rpy-list